Repository navigation
Commit 76ee4ab
committed
fix: add SIGHUP/SIGTERM/SIGPIPE handlers to prevent orphaned processes
When a controlling terminal is destroyed (SSH disconnect, tmux pane close),
opencode processes become orphaned because the TUI event loop blocks on
stdin that will never produce input, preventing process.exit() from executing.
Each orphaned instance leaks ~4.7 GB of RAM. On systems using tmux-based
session managers (e.g. oh-my-opencode), this can accumulate to 60+ GB.
Add signal handlers for SIGHUP, SIGTERM, and SIGPIPE that call process.exit(1)
immediately, ensuring clean shutdown on terminal death.
Fixes anomalyco#145041 parent f07e877 commit 76ee4ab
1 file changed
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
48 | 60 | | |
49 | 61 | | |
50 | 62 | | |
| |||
0 commit comments