Skip to content

Commit 49382b7

Browse files
authored
Capture both stdout and stderr from execa-spawned processes (#3073)
1 parent b51abf7 commit 49382b7

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

.changeset/fifty-pumpkins-wave.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"roo-cline": patch
3+
---
4+
5+
Capture stderr in execa-spawned processes

src/integrations/terminal/ExecaTerminalProcess.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,14 @@ export class ExecaTerminalProcess extends BaseTerminalProcess {
3838
shell: true,
3939
cwd: this.terminal.getCurrentWorkingDirectory(),
4040
cancelSignal: this.controller.signal,
41+
all: true,
4142
})`${command}`
4243

43-
this.terminal.setActiveStream(subprocess, subprocess.pid)
44-
this.emit("line", "")
44+
const stream = subprocess.iterable({ from: "all", preserveNewlines: true })
45+
this.terminal.setActiveStream(stream, subprocess.pid)
4546

46-
for await (const line of subprocess) {
47-
this.fullOutput += `${line}\n`
47+
for await (const line of stream) {
48+
this.fullOutput += line
4849

4950
const now = Date.now()
5051

@@ -62,6 +63,9 @@ export class ExecaTerminalProcess extends BaseTerminalProcess {
6263
console.error(`[ExecaTerminalProcess] shell execution error: ${error.message}`)
6364
this.emit("shell_execution_complete", { exitCode: error.exitCode ?? 0, signalName: error.signal })
6465
} else {
66+
console.error(
67+
`[ExecaTerminalProcess] shell execution error: ${error instanceof Error ? error.message : String(error)}`,
68+
)
6569
this.emit("shell_execution_complete", { exitCode: 1 })
6670
}
6771
}

0 commit comments

Comments
 (0)