Skip to content
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

macOS: fs.watch does not report delete of watched folder #52055

Closed
bpasero opened this issue Mar 12, 2024 · 3 comments · Fixed by libuv/libuv#4376
Closed

macOS: fs.watch does not report delete of watched folder #52055

bpasero opened this issue Mar 12, 2024 · 3 comments · Fixed by libuv/libuv#4376
Labels
fs Issues and PRs related to the fs subsystem / file system. libuv Issues and PRs related to the libuv dependency or the uv binding. macos Issues and PRs related to the macOS platform / OSX.

Comments

@bpasero
Copy link
Contributor

bpasero commented Mar 12, 2024

Version

v18.19.1

Platform

Darwin MBP-13-Work.local 23.4.0 Darwin Kernel Version 23.4.0: Wed Feb 21 21:44:06 PST 2024; root:xnu-10063.101.15~2/RELEASE_ARM64_T8103 arm64

Subsystem

fs

What steps will reproduce the bug?

Install a fs.watch on a folder path:

require("fs").watch("path to a folder", console.log);

Delete the folder from disk, for example with a fs.rm call.

How often does it reproduce? Is there a required condition?

Everytime.

What is the expected behavior? Why is that the expected behavior?

Deleting the watched folder path reports an event, similar to how an event is reported when watching a file path.

What do you see instead?

No event is fired when deleting the watched folder path.

Additional information

On Windows and Linux and event is reported.

@bpasero bpasero changed the title macOS: fs.watch does not report delete of folder macOS: fs.watch does not report delete of watched folder Mar 12, 2024
@atlowChemi atlowChemi added fs Issues and PRs related to the fs subsystem / file system. macos Issues and PRs related to the macOS platform / OSX. labels Mar 12, 2024
@akhoshrozeh
Copy link

Platform

Darwin MBP 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:28:58 PST 2023; root:xnu-10002.81.5~7/RELEASE_X86_64 x86_64

Node version

v18.19.1

I see fs.watch() emits a "rename" event when I delete a file. I'm guessing this is because of how of the OS is really unlinking a file under the hood. Does it not emit that type of event either?

@bpasero
Copy link
Contributor Author

bpasero commented Mar 13, 2024

@akhoshrozeh a rename event is emitted if you delete a file, but this is about watching a folder path and then deleting that folder path. The folder can be empty, does not make a difference it seems.

@santigimeno santigimeno added the libuv Issues and PRs related to the libuv dependency or the uv binding. label Mar 31, 2024
@santigimeno
Copy link
Member

Potential fix: libuv/libuv#4376

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fs Issues and PRs related to the fs subsystem / file system. libuv Issues and PRs related to the libuv dependency or the uv binding. macos Issues and PRs related to the macOS platform / OSX.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants