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
Linux: unable to watch a symbolic link folder #62
Comments
Perhaps we should call |
One thing VS Code does when it comes to file watching is to check whether the path to be watched is a symbolic link or not because it looks like on macOS using fs-events, you can pass a symbolic link to the native watch function, but you end up with the target of the link when it comes to the events (at least In other words, imagine:
For any watcher I would probably never expect the watcher to fail when I give it a symbolic link. The interesting question is whether you would expect the returned events to be in the form of the resolved link target or the original form. If you use the resolved link target, any upstream user needs to be aware of that. This is fine for VS Code given we already have that code, but maybe unexpected for others. Source pointers: https://github.com/microsoft/vscode/blob/5991e3c4b97eca5568069bf3e0910ab693ad3549/src/vs/platform/files/node/watcher/nsfw/nsfwWatcherService.ts#L246-L270 |
Not a big deal anymore for VS Code usage at least. We |
I think to be consistent with other platforms:
The latter is quite important because neither macOS nor Windows automatically watch symbolic links within the path to watch. A related issue in VS Code (microsoft/vscode#121854) results in high CPU on WSL (Linux) because a symbolic link is followed automatically for file watching and that can be a very expensive operation. If a client wants to watch a symbolic link, expect the client to pass in that path for watching and don't do it automatically. |
I think the current behaviour after all the changes for Linux is pretty fine now. |
Using
watcher@2.0.0-alpha.11
on Ubuntu 20. Steps:ln -s <linked-folder-path> <folder-path>
Error:
inotify_add_watch failed: Not a directory
Other watcher liks
nsfw
are not running into that problem it seems.The text was updated successfully, but these errors were encountered: