Version
main (commit 159ae48)
Platform
SunOS smartos 5.11 joyent_20260122T000642Z i86pc i386 i86pc
Subsystem
fs
What steps will reproduce the bug?
const fs = require('fs');
const watcher = fs.watch('.', {
recursive: false // The test passes if this option is set to `true`.
});
watcher.on('change', function (event, filename) {
console.log(event, filename);
if (filename === 'file.txt') {
watcher.close();
}
});
setTimeout(function () {
fs.writeFileSync('file.txt', 'data');
}, 100);
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior? Why is that the expected behavior?
change file.txt is written to the standard output and the process exits. This is what happens when the recursive option is set to true.
What do you see instead?
change null is written to the standard output and the process does not exit.
Additional information
No response
Version
main (commit 159ae48)
Platform
Subsystem
fs
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior? Why is that the expected behavior?
change file.txtis written to the standard output and the process exits. This is what happens when therecursiveoption is set totrue.What do you see instead?
change nullis written to the standard output and the process does not exit.Additional information
No response