Skip to content

Commit 3c5367d

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 b09c4fd commit 3c5367d

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
@@ -3279,13 +3279,20 @@ Fix all CI failures now by making the necessary changes.`
32793279
}, 10_000)
32803280

32813281
try {
3282-
// Use runClaude with interactive mode so Claude can use tools to fix files
3283-
await runClaude(claudeCmd, fixPrompt, {
3284-
...opts,
3285-
interactive: true,
3282+
// Use --print flag to run Claude in non-interactive mode
3283+
// This avoids stdin raw mode issues (Ink requires TTY for raw mode)
3284+
const printArgs = ['--print', ...prepareClaudeArgs([], opts)]
3285+
const result = await runCommandWithOutput(claudeCmd, printArgs, {
32863286
cwd: rootPath,
3287-
timeout: fixTimeout,
3287+
input: fixPrompt,
3288+
stdio: ['pipe', 'pipe', 'pipe'],
32883289
})
3290+
if (result.exitCode !== 0) {
3291+
log.warn(`Claude fix exited with code ${result.exitCode}`)
3292+
if (result.stderr) {
3293+
log.warn(`Claude stderr: ${result.stderr.slice(0, 500)}`)
3294+
}
3295+
}
32893296
} catch (error) {
32903297
log.warn(`Claude fix error: ${error.message}`)
32913298
} finally {

0 commit comments

Comments
 (0)