diff options
| author | James Long <[email protected]> | 2026-03-04 18:12:05 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-03-04 23:12:05 +0000 |
| commit | 45ac20b8aa1c96751af6824bf7dd736554ef7938 (patch) | |
| tree | 72add2cf240a590139daf7730040d4d3ad2dab5a | |
| parent | 218330aec1ee6c1e5482913387c308566235a871 (diff) | |
| download | opencode-45ac20b8aa1c96751af6824bf7dd736554ef7938.tar.gz opencode-45ac20b8aa1c96751af6824bf7dd736554ef7938.zip | |
fix(core): handle SIGHUP and kill process (#16057)
| -rw-r--r-- | packages/opencode/src/index.ts | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/packages/opencode/src/index.ts b/packages/opencode/src/index.ts index 35b42dce7..4fd5f0e67 100644 --- a/packages/opencode/src/index.ts +++ b/packages/opencode/src/index.ts @@ -46,6 +46,11 @@ process.on("uncaughtException", (e) => { }) }) +// Ensure the process exits on terminal hangup (eg. closing the terminal tab). +// Without this, long-running commands like `serve` block on a never-resolving +// promise and survive as orphaned processes. +process.on("SIGHUP", () => process.exit()) + let cli = yargs(hideBin(process.argv)) .parserConfiguration({ "populate--": true }) .scriptName("opencode") |
