-
-
Notifications
You must be signed in to change notification settings - Fork 606
Description
Description
When watching more than one file (non-polling), atomic writes on any files other than the first one that's changed are emitted as an unlink event, and then no more events are emitted for that file. The file that was written first continues to properly emit all events.
Versions:
- Chokidar:
4.0.3 - Node:
v22.14.0 - OS:
NixOS 25.05.802491.7c43f080a7f2 (Warbler)
Reproducing
import { watch } from "chokidar";
watch(["a", "b", "c"], {
persistent: true,
atomic: 500, // delay doesn't seem to affect bug behavior
}).on("all", (...a) => console.log(a));It's assumed that all three files (a, b, and c) already exist
- Update file
awith an atomic write (I use neovim). This will emit achangeevent. - Update files
bandc. Both of these will emit anunlinkevent after 500ms (or whatever delay was set)
Expected Behavior
All file updates should emit a change event
Context and Thoughts
I've reproduced this issue on NixOS and Ubuntu on WSL, so I don't think it's system specific. Also, watching each file with a completely separate FSWatcher works just fine, but that's effectively what the single watcher should be doing under the hood anyway so I can't imagine why. I imagine the problem is just a minor logic bug, so I'll look at the source myself to see if I can figure it out. Can't be much harder than building a workaround.... right?