You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fs.watch() reports removed directory as subdirectory of itself #25301
Affected versions: Latest release of Current and all LTSes - 11.6.0, 10.15.0, 8.15.0, and 6.16.0.
Affected platform: Linux (ok on macOS/Windows)
Subsystem: fs
Description
When using fs.watch() to watch a directory, and removing that very directory itself, a change event is emitted with a filename matching the directory itself.
To my knowledge, the standard way to obtain an absolute path of the affected file, is to path.join() the filename with the directory being watched.
As such, the emitted event is interpreted as if a subdirectory changed, which is incorrect.
I can confirm the behavior you're seeing and while I agree it's inconvenient, I don't think this is really fixable. Libuv bubbles up the events it receives from the operating system mostly unfiltered.
On macos, it receives just one event. On linux, it receives three. I tried a couple of things but filtering out the first two introduces more issues than it fixes.
Activity
bnoordhuis commentedon Jan 8, 2019
I can confirm the behavior you're seeing and while I agree it's inconvenient, I don't think this is really fixable. Libuv bubbles up the events it receives from the operating system mostly unfiltered.
On macos, it receives just one event. On linux, it receives three. I tried a couple of things but filtering out the first two introduces more issues than it fixes.
bnoordhuis commentedon Jan 23, 2019
There's been no further discussion in the last two weeks so I'll take the liberty of closing this out. Thanks anyway for the bug report.