-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
fs.watch file matching is one character off in windows #4351
Comments
@jsheely Seems like it matches any file if its name starts the same as the one we're watching for.
Editing and renaming triggers callback twice, unless 'matching' filename was renamed to something that doesn't match Reproduced on (Virtualbox) Not reproduced on
|
The watching functions in Windows watch directories not files. I do not see anything inside node or uv that checks for the specified file to be the file that triggered the change. Node documentation says that fs.watch relies on ReadDirectoryChangesW which is watching a directory not a specific file. Try fs.watchFIle instead. |
@GenuineRex True it does watch directories but it also knows what file was changed. The problem is that the libuv abstraction returns the closest file that matches the pattern being watched currently and not the actual full path to the file that was changed. However the real file name is available that was modified and can be sent out to the event loop. I have tracked down the bug to here. #4429 Note: That this still fires a change event for a file in the directory but libraries will now be capable of filtering them out as the pattern won't match a file they are watching. |
I see it now. |
Libuv 1.9 has a number of Windows file watcher fixes. I don't know when you plan on releasing the next v5, but there's a good chance it fixes this issue. |
Another issue probably related: nodejs/node-v0.x-archive#25689 |
This is fixed by libuv/libuv#682. There has not yet been a libuv release containing the fix: it came after the last libuv release, v1.9.1. |
Fixes: nodejs#4351 Fixes: nodejs#6763 Refs: nodejs#8280 PR-URL: nodejs#9267 Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]>
Fixes: #4351 Fixes: #6763 Refs: #8280 PR-URL: #9267 Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]>
Fixes: #4351 Fixes: #6763 Refs: #8280 PR-URL: #9267 Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]>
Fixes: #4351 Fixes: #6763 Refs: #8280 PR-URL: #9267 Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]>
Fixes: nodejs/node#4351 Fixes: nodejs/node#6763 Refs: nodejs/node#8280 PR-URL: nodejs/node#9267 Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]>
Note: Tested on Windows 10
The text was updated successfully, but these errors were encountered: