Skip to content

fix: Windows daemon ENOENT, keepalive drain, and headless worker shell resolution#1447

Open
onurgoz wants to merge 1 commit intoruvnet:mainfrom
onurgoz:fix/windows-daemon-path-and-keepalive
Open

fix: Windows daemon ENOENT, keepalive drain, and headless worker shell resolution#1447
onurgoz wants to merge 1 commit intoruvnet:mainfrom
onurgoz:fix/windows-daemon-path-and-keepalive

Conversation

@onurgoz
Copy link
Copy Markdown

@onurgoz onurgoz commented Mar 26, 2026

Summary

Fixes 3 of 4 bugs reported in #1446 — Windows daemon and headless worker failures:

Bug 1: Daemon ENOENT with spaced paths

spawn(process.execPath, ...) with shell: true on Windows fails when process.execPath contains spaces (e.g. C:\Program Files\nodejs\node.exe) because cmd.exe splits on unquoted spaces.

Fix: Quote process.execPath on Windows before passing to spawn.

Bug 2: Daemon dies in quiet/detached mode

await new Promise(() => {}) alone does not keep the Node.js event loop alive when there's no active I/O handle. The daemon exits within 1-2 seconds.

Fix: Add setInterval(() => {}, 60_000) as an active timer handle before the blocking promise.

Bug 3: Headless workers empty output on Windows

spawn('claude', ...) without shell: true fails on Windows because claude is installed as claude.cmd — Node's spawn doesn't search PATH for .cmd extensions without shell mode.

Fix: Add shell: true to spawn options on Windows.

Changed files

File Line Change
v3/@claude-flow/cli/src/commands/daemon.ts 285 Quote process.execPath on Windows
v3/@claude-flow/cli/src/commands/daemon.ts 180 Add setInterval keepalive in quiet mode
v3/@claude-flow/cli/src/services/headless-worker-executor.ts 1146 Add shell: true on Windows

Test plan

  • On Windows with Node.js installed in C:\Program Files\: npx ruflo daemon start should succeed
  • Daemon should stay alive in --foreground --quiet mode
  • Headless workers should produce non-empty output on Windows
  • Verify no regression on macOS/Linux (changes are Windows-only)

Ref #1446

…worker shell resolution

- Quote process.execPath when spawning daemon on Windows to handle
  spaces in paths like "C:\Program Files\nodejs\node.exe" (ENOENT)

- Add setInterval keepalive before bare Promise in quiet/foreground
  daemon mode to prevent premature event loop exit when no active I/O

- Use shell: true for headless worker spawn on Windows so Node can
  resolve 'claude' to 'claude.cmd' via PATH

Ref ruvnet#1446
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant