Skip to content

Commit 22b2ba1

Browse files
committed
Fix claude --green subprocess stdin raw mode error
When claude --green spawns Claude Code as a subprocess to apply CI fixes, it was using interactive mode with piped stdin. This caused Ink (Claude's UI library) to fail when trying to use raw mode on the piped stdin. Solution: Use --print flag to run Claude in non-interactive mode. This avoids the raw mode requirement while still allowing Claude to use tools to make file changes. Changes: - Replace runClaude(..., { interactive: true }) with direct call to runCommandWithOutput using --print flag - Add error logging for non-zero exit codes
1 parent 4b5d67d commit 22b2ba1

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

scripts/claude.mjs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3213,13 +3213,20 @@ Fix all CI failures now by making the necessary changes.`
32133213
}, 10_000)
32143214

32153215
try {
3216-
// Use runClaude with interactive mode so Claude can use tools to fix files
3217-
await runClaude(claudeCmd, fixPrompt, {
3218-
...opts,
3219-
interactive: true,
3216+
// Use --print flag to run Claude in non-interactive mode
3217+
// This avoids stdin raw mode issues (Ink requires TTY for raw mode)
3218+
const printArgs = ['--print', ...prepareClaudeArgs([], opts)]
3219+
const result = await runCommandWithOutput(claudeCmd, printArgs, {
32203220
cwd: rootPath,
3221-
timeout: fixTimeout,
3221+
input: fixPrompt,
3222+
stdio: ['pipe', 'pipe', 'pipe'],
32223223
})
3224+
if (result.exitCode !== 0) {
3225+
log.warn(`Claude fix exited with code ${result.exitCode}`)
3226+
if (result.stderr) {
3227+
log.warn(`Claude stderr: ${result.stderr.slice(0, 500)}`)
3228+
}
3229+
}
32233230
} catch (error) {
32243231
log.warn(`Claude fix error: ${error.message}`)
32253232
} finally {

0 commit comments

Comments
 (0)