cortesi / modd

A flexible developer tool that runs processes and responds to filesystem changes
MIT License
2.8k stars 128 forks source link

Watching a file does not work anymore #46

Closed GeertJohan closed 6 years ago

GeertJohan commented 6 years ago

It looks like a recent change to modd broke it's ability to watch for changes on a single file on linux.

e.g. with the following mod.conf:

somefolder/Makefile somefolder/*.go {
    # do stuff
}

This used to work fine, but now breaks with Error watching: readdirent: not a directory. When I remove the first selector (somefolder/Makefile), modd runs fine.

A nasty workarround is to add an asterist, e.g.: someolder/*Makefile, which sill then also match Makefile itself. However, it's not very nice and might result in unexpected behaviour, for example when somefolder/dontMindMe.Makefile is added.

cortesi commented 6 years ago

Hi there. Thanks for reporting this. I've just revamped the relevant code, and added some unit tests to cover this case. Could you please confirm for me that the issue is fixed in the current master?

GeertJohan commented 6 years ago

I just go-getted the latest versions. I get the same error (just a bit more verbose now, as it includes the path): 22:59:33: Error watching: could not watch path '/home/geertjohan/src/path/to/some/file': readdirent: not a directory

cortesi commented 6 years ago

Heh. Let's try that again. :) I've just made some more changes in the moddwatch repo - how does it look on your end?

GeertJohan commented 6 years ago

Yes, looks like it's working again, thanks!