fix(core): handle SIGHUP and kill process (#16057)

This commit is contained in:
James Long
2026-03-04 18:12:05 -05:00
committed by GitHub
parent 218330aec1
commit 45ac20b8aa

View File

@@ -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")