Skip to content

Commit 17b0a95

Browse files
fix(opencode): remove shell tool detached flag to prevent zombie processes
On Linux, spawning shell children with `detached: true` calls setsid() which puts them in their own process group. Without a SIGCHLD handler, exited children become zombies. Explicit cleanup is already handled via handle.kill() in abort/timeout paths, making signal-group isolation unnecessary. Fixes anomalyco#29506
1 parent e5cf3ad commit 17b0a95

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎packages/opencode/src/tool/shell.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,12 @@ function cmd(shell: string, command: string, cwd: string, env: NodeJS.ProcessEnv
301301
cwd,
302302
env,
303303
stdin: "ignore",
304-
detached: process.platform !== "win32",
304+
// Do not use detached: true. On Linux it calls setsid() which puts the
305+
// child in its own process group/session. Without an explicit SIGCHLD
306+
// handler the children become zombies when they exit before the parent
307+
// reaps them. Explicit cleanup is already handled via handle.kill() in
308+
// abort/timeout paths, so signal-group isolation is unnecessary.
309+
detached: false,
305310
})
306311
}
307312
const parser = lazy(async () => {

0 commit comments

Comments
 (0)