Description
Version
22.13.1
Platform
Darwin macbookpro.lan 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:16 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6000 arm64 arm Darwin
Subsystem
No response
What steps will reproduce the bug?
Full reduced test case: https://github.com/OliverJAsh/node-watch-bug
src/server.js:
setTimeout(() => {}, 100000);- Run
node --watch --watch-path=./src/ ./src/server.js - In another terminal run
touch ./src/server.js.
How often does it reproduce? Is there a required condition?
Every time.
What is the expected behavior? Why is that the expected behavior?
1 restart event/log:
Restarting './src/server.js'
This is what we get when we remove --watch and only specify --watch-path:
$ node --watch-path=./src/ ./src/server.js
Restarting './src/server.js'Curiously, this is also the behaviour we get if we add --watch-preserve-output:
$ node --watch --watch-preserve-output --watch-path=./src/ ./src/server.js
Restarting './src/server.js'What do you see instead?
2 restart events/logs:
$ node --watch --watch-path=./src/ ./src/server.js
Restarting './src/server.js'
Restarting './src/server.js'Additional information
This part of the docs seems relevant:
This will turn off watching of required or imported modules, even when used in combination with --watch.
https://nodejs.org/docs/latest-v22.x/api/cli.html#--watch-path
Potentially related: #55189
Reacted by Sam A. Horvath-Hunt and Alex Caza
Metadata
Metadata
Assignees
Labels
No labels
Activity
juanarbol commentedon Feb 24, 2025
Ping @nodejs/libuv
macOS is quite messy with the watcher 🫠💔
bnoordhuis commentedon Feb 24, 2025
Libuv passes on the events it receives from FSEvents more or less verbatim, it doesn't do debouncing. If node needs that, it needs to implement it itself.
dario-piotrowicz commentedon May 6, 2025
I'm reopening this since the PR that fixed this issue (#57936) unfortunately needed to be reverted
I will look soon into reintroducing the fix 😓
watch: fix watch args not being properly filtered
watch: fix watch args not being properly filtered
watch: fix watch args not being properly filtered