mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-22 10:03:29 +08:00
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.
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user