From 49382b7d8976ab4e10ffa688d110461807726887 Mon Sep 17 00:00:00 2001 From: Chris Estreich Date: Wed, 30 Apr 2025 12:49:48 -0700 Subject: [PATCH] Capture both stdout and stderr from execa-spawned processes (#3073) --- .changeset/fifty-pumpkins-wave.md | 5 +++++ src/integrations/terminal/ExecaTerminalProcess.ts | 12 ++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 .changeset/fifty-pumpkins-wave.md diff --git a/.changeset/fifty-pumpkins-wave.md b/.changeset/fifty-pumpkins-wave.md new file mode 100644 index 0000000000..c128270bb4 --- /dev/null +++ b/.changeset/fifty-pumpkins-wave.md @@ -0,0 +1,5 @@ +--- +"roo-cline": patch +--- + +Capture stderr in execa-spawned processes diff --git a/src/integrations/terminal/ExecaTerminalProcess.ts b/src/integrations/terminal/ExecaTerminalProcess.ts index 1fe9e29278..1f41fa082d 100644 --- a/src/integrations/terminal/ExecaTerminalProcess.ts +++ b/src/integrations/terminal/ExecaTerminalProcess.ts @@ -38,13 +38,14 @@ export class ExecaTerminalProcess extends BaseTerminalProcess { shell: true, cwd: this.terminal.getCurrentWorkingDirectory(), cancelSignal: this.controller.signal, + all: true, })`${command}` - this.terminal.setActiveStream(subprocess, subprocess.pid) - this.emit("line", "") + const stream = subprocess.iterable({ from: "all", preserveNewlines: true }) + this.terminal.setActiveStream(stream, subprocess.pid) - for await (const line of subprocess) { - this.fullOutput += `${line}\n` + for await (const line of stream) { + this.fullOutput += line const now = Date.now() @@ -62,6 +63,9 @@ export class ExecaTerminalProcess extends BaseTerminalProcess { console.error(`[ExecaTerminalProcess] shell execution error: ${error.message}`) this.emit("shell_execution_complete", { exitCode: error.exitCode ?? 0, signalName: error.signal }) } else { + console.error( + `[ExecaTerminalProcess] shell execution error: ${error instanceof Error ? error.message : String(error)}`, + ) this.emit("shell_execution_complete", { exitCode: 1 }) } }