-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
fs.watch(): EINVAL on Windows watching a root file #4643
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
/cc @nodejs/platform-windows |
When watching files, I think libuv actually creates a watch on the parent directory of the file (https://github.com/libuv/libuv/blob/v1.x/src/win/fs-event.c#L188), in this case |
Yes, otherwise you will get an EPERM |
This looks like a bug in libuv. If the file is at the root, and we try split the path into a directory name and file name (https://github.com/libuv/libuv/blob/f1a13e9b4abe8c97768a1d38b12ca3766c8a9b34/src/win/fs-event.c#L198-L206), we end up with a directory name that doesn't have a trailing backslash, e.g. I'll add this to my queue of fixes. If anyone else wants to open a PR to https://github.com/libuv/libuv, you are welcome to do so. Thanks for reporting this issue! |
@CxRes It's part of libuv but not yet of any release. It will be part of the next one, which should happen by Node 6.0. |
@saghul Thanks! |
Fixes: nodejs#5737 Fixes: nodejs#4643 Fixes: nodejs#4291 Fixes: nodejs/node-v0.x-archive#8960 Refs: nodejs#3594 PR-URL: nodejs#5994
Fixes: nodejs#5737 Fixes: nodejs#4643 Fixes: nodejs#4291 Fixes: nodejs/node-v0.x-archive#8960 Refs: nodejs#3594 PR-URL: nodejs#5994 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
node.js: 4.2.1
OS: Win10
fs.watch("C:\\test.txt")
=>
The text was updated successfully, but these errors were encountered: