mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-23 04:26:54 +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:
parent
d87304573c
commit
163cdee60f
@ -91,11 +91,16 @@ function askClaude(systemPrompt, history, userMessage, model) {
|
|||||||
}
|
}
|
||||||
args.push('-p', fullPrompt);
|
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, {
|
const result = spawnSync('claude', args, {
|
||||||
encoding: 'utf8',
|
encoding: 'utf8',
|
||||||
stdio: ['pipe', 'pipe', 'pipe'],
|
stdio: ['pipe', 'pipe', 'pipe'],
|
||||||
env: { ...process.env, CLAUDECODE: '' },
|
env: { ...process.env, CLAUDECODE: '' },
|
||||||
timeout: 300000,
|
timeout: 300000,
|
||||||
|
shell: process.platform === 'win32',
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result.error) {
|
if (result.error) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user