Skip to content

armgit / ECC

Public Imported from GitHub
0

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

fix: send claude prompt via stdin so Windows shell mode does not mangle it (#2174)

skausage-ops3e671ff8487a
diff --git a/scripts/claw.js b/scripts/claw.js
index 04a4228ce..121859a1e 100644
--- a/scripts/claw.js
+++ b/scripts/claw.js
@@ -89,13 +89,17 @@ function askClaude(systemPrompt, history, userMessage, model) {
if (model) {
args.push('--model', 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.
+ args.push('-p');
+
+ // On Windows the `claude` binary installed via npm is `claude.cmd`/`claude.ps1`,
+ // and Node's spawn() cannot resolve those wrappers via PATH without shell: true.
+ // But shell mode concatenates args *unescaped*, so a multi-line prompt passed as
+ // an arg gets mangled (newlines and the `===` section markers truncate it, and
+ // claude receives an empty prompt). Fix: send the prompt over stdin via `input`
+ // and keep only the short, safe flags (`--model`, `-p`) as args.
// 'claude' is a hardcoded literal here (not user input), so shell mode is safe.
const result = spawnSync('claude', args, {
+ input: fullPrompt,
encoding: 'utf8',
stdio: ['pipe', 'pipe', 'pipe'],
env: { ...process.env, CLAUDECODE: '' },