Summary
scripts/claw.js:94 calls spawnSync('claude', args, { ... }) with no shell option. On Windows, the installed claude binary is claude.cmd (a batch wrapper), and Node's spawn cannot resolve .cmd via PATH without shell: true. The call fails with spawn claude ENOENT and askClaude() returns an error string to the caller.
Root cause
Same class of bug as issue #1455 (fixed in PR #1456 for the MCP health-check hook): commands on PATH that are actually .cmd shims require shell: true on Windows; absolute paths must not use shell mode because cmd.exe misparses spaces in paths.
Reproduction
- Windows 10 / 11
claude installed via npm i -g @anthropic-ai/claude-code (creates claude.cmd)
- Run
node scripts/claw.js <args> — askClaude() errors with spawn claude ENOENT
Proposed fix
Mirror the pattern used in scripts/hooks/mcp-health-check.js after PR #1456:
- Add
needsShell = process.platform === 'win32' && typeof command === 'string' && !path.isAbsolute(command) && !UNSAFE_SHELL_CHARS.test(command) gate
- Pass
shell: needsShell to spawnSync
Since claw.js hardcodes 'claude' (trusted value, not user input), the safety checks are defensive but keep the pattern consistent.
Related
Summary
scripts/claw.js:94callsspawnSync('claude', args, { ... })with noshelloption. On Windows, the installedclaudebinary isclaude.cmd(a batch wrapper), and Node'sspawncannot resolve.cmdvia PATH withoutshell: true. The call fails withspawn claude ENOENTandaskClaude()returns an error string to the caller.Root cause
Same class of bug as issue #1455 (fixed in PR #1456 for the MCP health-check hook): commands on PATH that are actually
.cmdshims requireshell: trueon Windows; absolute paths must not use shell mode becausecmd.exemisparses spaces in paths.Reproduction
claudeinstalled vianpm i -g @anthropic-ai/claude-code(createsclaude.cmd)node scripts/claw.js <args>—askClaude()errors withspawn claude ENOENTProposed fix
Mirror the pattern used in
scripts/hooks/mcp-health-check.jsafter PR #1456:needsShell = process.platform === 'win32' && typeof command === 'string' && !path.isAbsolute(command) && !UNSAFE_SHELL_CHARS.test(command)gateshell: needsShelltospawnSyncSince
claw.jshardcodes'claude'(trusted value, not user input), the safety checks are defensive but keep the pattern consistent.Related
spawn/spawnSyncusage inscripts/confirmsclaw.jsis the only other occurrence of the same bug; other call sites either already handle.cmdexplicitly (post-edit-format.js,stop-format-typecheck.js) or use absolute paths (process.execPath).