From e975e30bd5ebc9efc000f7b645a1503be2b2ca10 Mon Sep 17 00:00:00 2001 From: Chris Estreich Date: Wed, 30 Apr 2025 01:00:46 -0700 Subject: [PATCH] Command execution component tweaks (#3059) --- .../terminal/ExecaTerminalProcess.ts | 2 +- .../src/components/chat/CommandExecution.tsx | 47 +++++++++++-------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/src/integrations/terminal/ExecaTerminalProcess.ts b/src/integrations/terminal/ExecaTerminalProcess.ts index d7695bdf6d..1fe9e29278 100644 --- a/src/integrations/terminal/ExecaTerminalProcess.ts +++ b/src/integrations/terminal/ExecaTerminalProcess.ts @@ -60,7 +60,7 @@ export class ExecaTerminalProcess extends BaseTerminalProcess { } catch (error) { if (error instanceof ExecaError) { console.error(`[ExecaTerminalProcess] shell execution error: ${error.message}`) - this.emit("shell_execution_complete", { exitCode: error.exitCode ?? 1, signalName: error.signal }) + this.emit("shell_execution_complete", { exitCode: error.exitCode ?? 0, signalName: error.signal }) } else { this.emit("shell_execution_complete", { exitCode: 1 }) } diff --git a/webview-ui/src/components/chat/CommandExecution.tsx b/webview-ui/src/components/chat/CommandExecution.tsx index f156e39577..7e2acdb492 100644 --- a/webview-ui/src/components/chat/CommandExecution.tsx +++ b/webview-ui/src/components/chat/CommandExecution.tsx @@ -28,7 +28,10 @@ export const CommandExecution = forwardRef(null) - const lines = useMemo(() => output.split("\n").filter((line) => line.trim() !== ""), [output]) + const lines = useMemo( + () => [`$ ${command}`, ...output.split("\n").filter((line) => line.trim() !== "")], + [command, output], + ) const onMessage = useCallback( (event: MessageEvent) => { @@ -61,14 +64,14 @@ export const CommandExecution = forwardRef -
- {command} -
+
+ {command} +
{status?.status === "running" && ( -
+
Running
- {status.pid &&
(PID: {status.pid})
} + {status.pid &&
(PID: {status.pid})
} -
+ )}
-
+
{lines.length > 0 && (