Fix Windows wizard failure by sending prompt via stdin for stream-json mode

When using stream-json output mode on Windows, the prompt was being added
both as a CLI argument AND sent via stdin, causing the command line to
exceed cmd.exe's ~8191 character limit and resulting in immediate exit
code 1.

Now detects when stream-json is in the args and ensures the prompt is
sent only via stdin, avoiding the command line length limit.

Fixes #301

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
David Maynor
2026-02-04 22:56:52 -05:00
parent 4080153666
commit 2d227ed02c

View File

@@ -73,7 +73,11 @@ export class ChildProcessSpawner {
// Check if prompt will be sent via stdin instead of command line
// This is critical for SSH remote execution to avoid shell escaping issues
const promptViaStdin = sendPromptViaStdin || sendPromptViaStdinRaw;
// Also critical on Windows: when using stream-json output mode, the prompt is sent
// via stdin (see stream-json stdin write below). Adding it as a CLI arg too would
// exceed cmd.exe's ~8191 character command line limit, causing immediate exit code 1.
const argsHaveStreamJson = args.some((arg) => arg.includes('stream-json'));
const promptViaStdin = sendPromptViaStdin || sendPromptViaStdinRaw || argsHaveStreamJson;
// Build final args based on batch mode and images
let finalArgs: string[];