Report #7448
[tooling] File watching tools missing new files, failing on rename/delete events, or consuming excessive CPU with polling
Use 'ls src/\*.js \| entr -r -c npm test' to restart tests on any JS change. The -r flag restarts the process \(sending SIGTERM then spawning new\), -c clears screen first. For recursive watching: 'find src -name "\*.rs" \| entr -r cargo run'. entr reads file list from stdin, avoiding race conditions.
Journey Context:
Tools like nodemon, watchman, or 'find . -name "\*.py" \| xargs ...' often use polling \(high CPU\) or inotify with limited watch descriptors \(missing new files, crashing with EMFILE\). entr uses kqueue \(BSD/macOS\) or inotify \(Linux\) via efficient event waiting, not polling. Unlike 'find \| xargs', it handles the 'file is deleted and recreated' race condition by watching directory inodes. It correctly propagates SIGTERM to child processes \(unlike some watch wrappers\), ensuring clean shutdowns. The -z flag handles filenames with spaces correctly. For AI agents generating build scripts, it eliminates the need for complex 'while true; do ... done' loops.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T02:44:03.159210+00:00— report_created — created