Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/core/tools/ExecuteCommandTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,10 @@ function formatExitStatus(exitDetails: ExitCodeDetails | undefined): string {
return "Exit code: <undefined, notify user>"
}

if (exitDetails.aborted) {
return "Command was aborted by the user."
}

if (exitDetails.signalName) {
let status = `Process terminated by signal ${exitDetails.signalName}`
if (exitDetails.coreDumpPossible) {
Expand Down
2 changes: 1 addition & 1 deletion src/integrations/terminal/ExecaTerminalProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export class ExecaTerminalProcess extends BaseTerminalProcess {
}
}

this.emit("shell_execution_complete", { exitCode: 0 })
this.emit("shell_execution_complete", { exitCode: 0, aborted: this.aborted })
} catch (error) {
if (error instanceof ExecaError) {
console.error(`[ExecaTerminalProcess#run] shell execution error: ${error.message}`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ describe("ExecaTerminalProcess", () => {
const spy = vitest.fn()
terminalProcess.on("shell_execution_complete", spy)
await terminalProcess.run("echo test")
expect(spy).toHaveBeenCalledWith({ exitCode: 0 })
expect(spy).toHaveBeenCalledWith({ exitCode: 0, aborted: false })
})

it("should emit completed event with full output", async () => {
Expand Down
6 changes: 6 additions & 0 deletions src/integrations/terminal/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,10 @@ export interface ExitCodeDetails {
signal?: number | undefined
signalName?: string
coreDumpPossible?: boolean
/**
* Set to true when the user explicitly pressed the Abort button
* to terminate the command, as opposed to the process exiting on its own
* or being killed by the OS (e.g., OOM-killer).
*/
aborted?: boolean
}
Loading