shama / gaze

:crystal_ball: A globbing fs.watch wrapper built from the best parts of other fine watch libs.
MIT License
1.16k stars 167 forks source link

Fixes race condition with watchDir #237

Open alexgorbatchev opened 7 years ago

alexgorbatchev commented 7 years ago

I have a script that is actively deleting some of the directories being watched, this was causing gaze to fall over with ENOENT exception.

This PR addresses this issue.

alexgorbatchev commented 7 years ago

@shama any thoughts on this?

shama commented 7 years ago

I don't think this fixes an issue. Calling watch on a non-existent file should cause it to throw and there is a try catch there. So the ENOENT is probably caused by something else.

alexgorbatchev commented 7 years ago

This was the fix that prevented gaze from crashing in my scenario. Basically, files were being built and placed in the watched folder. Before the build, whole build folder would be removed.