Skip to content

Commit e80b4e1

Browse files
committed
fix(terminal): address CodeRabbit feedback -- fix cleanup on abort path and improve changeset wording
1 parent 84f4c18 commit e80b4e1

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

.changeset/kill-orphaned-child-processes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"zoo-code": patch
33
---
44

5-
fix(terminal): kill entire process group on Stop so child commands (e.g. `sleep 30`) are not orphaned and allowed to continue running after user clicked 'Stop'.
5+
fix(terminal): kill entire process group on Stop so child commands (e.g. `sleep 30`) are also killed when the user clicks 'Stop', rather than the shell waiting for them to finish.

src/integrations/terminal/ExecaTerminalProcess.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,20 +81,19 @@ export class ExecaTerminalProcess extends BaseTerminalProcess {
8181
this.startHotTimer(line)
8282
}
8383

84-
if (this.aborted) {
84+
if (this.aborted) {
8585
try {
8686
await this.subprocess
8787
} catch (error) {
8888
// Expected: process was killed by abort(); swallow the error.
8989
}
9090

91-
// emit signal 128 + 9 (SIGKILL) to match conventional shell exit code so
92-
// the front-end correctly detects a non-normal exit
91+
// 128 + 9 (SIGKILL) mirrors the conventional shell exit code so the
92+
// UI indicator correctly shows a non-zero (red) exit.
9393
this.emit("shell_execution_complete", { exitCode: 137, signalName: "SIGKILL" })
94-
return
94+
} else {
95+
this.emit("shell_execution_complete", { exitCode: 0 })
9596
}
96-
97-
this.emit("shell_execution_complete", { exitCode: 0 })
9897
} catch (error) {
9998
// If abort() fired and the stream threw before the loop checked this.aborted,
10099
// treat it as a SIGKILL exit rather than a generic error.

0 commit comments

Comments
 (0)