Skip to content

fix: reap child processes on session stop/kill#8

Merged
schovi merged 1 commit intomainfrom
fix/zombie-process-reaping
Feb 18, 2026
Merged

fix: reap child processes on session stop/kill#8
schovi merged 1 commit intomainfrom
fix/zombie-process-reaping

Conversation

@schovi
Copy link
Owner

@schovi schovi commented Feb 18, 2026

Summary

  • captureOutput goroutine could exit via the done channel (closed by handleStop/handleKill) without calling cmd.Wait(), leaving terminated child processes as zombies in the process table
  • Moved cmd.Wait() and p.Close() into a defer so the child is always reaped regardless of exit path (done channel vs Read error)

Test plan

  • make test passes
  • Manual: create session, stop it, verify no zombie (ps aux | grep defunct)
  • Manual: create session, kill it, verify no zombie

captureOutput goroutine could exit via the done channel without calling
cmd.Wait(), leaving terminated child processes as zombies in the process
table. Moved cmd.Wait() and p.Close() into a defer so the child is
always reaped regardless of exit path.
@schovi schovi force-pushed the fix/zombie-process-reaping branch from 3290dbe to f346e77 Compare February 18, 2026 07:43
@schovi schovi merged commit 0ac25a7 into main Feb 18, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant