-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ENOENT errors in _addToWatched #60
Conversation
Should also fix #58 |
Hi @shama, is there anything you would like me to do to improve this pull-request? |
Thanks for the pull request. I'm not sure catching and ignoring the error within gaze is the best solution at this point. I'm in the process of writing a layer for gaze to sit upon to take care of some other open issues. I'll take a look at this and the ENOENT errors a bit more once that platform is done as it will likely fix the race conditions that can occur at present. |
So thinking about it, the error that is being caught tells us that the file I can take a look at finding a way to log this if you'd like, but this Many thanks, Andy On 20 December 2013 17:20, Kyle Robinson Young notifications@github.comwrote:
Andrew Thornton |
Hi, I've updated the fix to emit a warning. In reality this is rather the same as the previous solution as emit('warning') appears to be being squashed somewhere. I note that further up the library in helper.forEachSeries there is a empty catch section that doesn't check the type of error. It appears that this is a race-condition fix for a non-existent file. In this case, a more appropriate fix might be to check the type of error thrown, and emit a warning as per the latest if there is ENOENT (which is what the race-condition should throw.) Otherwise, it should likely just emit error. I will happily rewrite _handleWarning to use util.log() if you would like rather than emit error. How's the work going on the sublayer? |
Cool thanks, I'll take another look at this once v0.5 is ready. It's getting close. Check out the v0.5 branch. Currently there is 1 failing test on linux, platform needs more tests and the pathwatcher dep needs to get packaged up into the library. |
Another option might be to use fs.lstatSync to determine whether the file in question is a symlink, and if so, use fs.readlinkSync to determine if the file being pointed to exists. |
I know there are big issues in gaze master that are holding up 0.6, but it would sure make a lot of people's lives a lot easier if this patch could be applied to the 0.5.1 tag and a 0.5.2 released that is identical to 0.5.1 but includes this fix. I'd be happy to do it myself, given appropriate npm collaborator status. The workarounds that we are reduced to in the meantime are pretty horrific: https://github.com/jacksonrayhamilton/fix-gaze |
@carljm The fix has been backported and published as |
0.5.2 does fix the problem -- thank you!! |
This fixes #45.
The additional test simply tries to run gaze on a filesystem where there is a broken symlink.
A more complete test-set would try to cause the race condition whereby a file that is due to be stat'd is deleted after it is queued but before fs.statSync is run however I am unsure how to go about creating that test.