Skip to content

Commit feae71c

Browse files
CarlosZieglerclaude
andcommitted
fix(cli): drain stdout/stderr concurrently to prevent pipe deadlock
Sequential reads can deadlock when child process fills stderr pipe buffer (~64KB) before stdout is consumed. Use Promise.all to drain both streams in parallel. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c6f8096 commit feae71c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

packages/cli/src/lib/helpers.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,10 @@ export async function exec(
9494
stderr: "pipe",
9595
});
9696

97-
const stdout = await new Response(proc.stdout).text();
98-
const stderr = await new Response(proc.stderr).text();
97+
const [stdout, stderr] = await Promise.all([
98+
new Response(proc.stdout).text(),
99+
new Response(proc.stderr).text(),
100+
]);
99101
const exitCode = await proc.exited;
100102

101103
return { stdout: stdout.trim(), stderr: stderr.trim(), exitCode };

0 commit comments

Comments
 (0)