WebFreak001 / FSWatch

A cross-platform folder & file watching library using win32, inotify or std.file
32 stars 8 forks source link

Does not work on Debian 12 x64 Linux without FSWForcePoll #27

Open ponyatov opened 7 months ago

ponyatov commented 7 months ago
    "dependencies": {
        "fswatch": "~>0.6.1"
    "versions": []
dmd --version
DMD64 D Compiler v2.105.3
Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved written by Walter Bright
uname -a
Linux i7 6.1.0-13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.55-1 (2023-09-29) x86_64 GNU/Linux

sample code:

void watcher() {
    auto src = FileWatch("src/", true);
    auto views = FileWatch("views/", true);
    auto dub = FileWatch("dub.json", true);
    while (true) {
        Thread.sleep(1111.msecs);
        foreach (e; src.getEvents)
            writeln(e.path, '\t', e.type);
        foreach (e; views.getEvents)
            writeln(e.path, '\t', e.type);
        foreach (e; dub.getEvents)
            writeln(e.path, '\t', e.type);
    }
}

void main(string[] args) {
    writeln(args);
    // autorestart
    spawn(&watcher);
ponyatov commented 7 months ago

Does not see any changes, but with ForcePoll works ok:

Running bin/wad 
["/home/dponyatov/wad/bin/wad"]
[main(----) INF] Listening for requests on http://127.0.0.1:12345/

src/server.d        modify
ponyatov commented 7 months ago
inotifywait -m src
Setting up watches.
Watches established.
src/ OPEN,ISDIR 
src/ ACCESS,ISDIR 
src/ CLOSE_NOWRITE,CLOSE,ISDIR 

inotify enabled and works with its tools ok