From 163cdee60ffe1ddeb575c51c4e760f9027a2f788 Mon Sep 17 00:00:00 2001 From: Michael <36601233+mike-batrakov@users.noreply.github.com> Date: Tue, 21 Apr 2026 15:02:13 -0700 Subject: [PATCH] fix(scripts): resolve claude.cmd on Windows by enabling shell for spawn (#1471) Fixes #1469. On Windows the `claude` binary installed via `npm i -g @anthropic-ai/claude-code` is `claude.cmd`, and Node's spawn() cannot resolve .cmd wrappers via PATH without shell: true. The call failed with `spawn claude ENOENT` and claw.js returned an error string to the caller. Mirrors the fix pattern applied in PR #1456 for the MCP health-check hook. 'claude' is a hardcoded literal (not user input), so enabling shell on Windows only is safe. --- scripts/claw.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/claw.js b/scripts/claw.js index 0ff539b8..04a4228c 100644 --- a/scripts/claw.js +++ b/scripts/claw.js @@ -91,11 +91,16 @@ function askClaude(systemPrompt, history, userMessage, model) { } args.push('-p', fullPrompt); + // On Windows, the `claude` binary installed via npm is `claude.cmd`. + // Node's spawn() cannot resolve `.cmd` wrappers via PATH without shell: true, + // so this call fails with `spawn claude ENOENT` on Windows otherwise. + // 'claude' is a hardcoded literal here (not user input), so shell mode is safe. const result = spawnSync('claude', args, { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'], env: { ...process.env, CLAUDECODE: '' }, timeout: 300000, + shell: process.platform === 'win32', }); if (result.error) {