Commit 07375e9
committed
fix(core): keep nx watch process alive while listening for file changes
The watch command was exiting immediately after registering the file watcher
because the registerFileWatcher() function completed and there was nothing
keeping the Node.js event loop alive.
Unlike the main daemon socket which has a keep-alive timeout, the file watcher
socket doesn't generate any timers or pending promises that would prevent the
process from exiting.
Fix: Add an infinite promise after registering the file watcher. This keeps
the event loop alive indefinitely while the file watcher callbacks handle
incoming file change events. The process will exit cleanly when:
- User presses Ctrl+C (signal handler)
- The file watcher connection closes (callback receives 'closed' event)1 parent 0dfff55 commit 07375e9
1 file changed
+5
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
244 | 249 | | |
0 commit comments