fix(core): restore SIGHUP exit handler (#16057)

This restores the SIGHUP handler that was previously reverted. The handler ensures the process exits on terminal hangup (eg. closing the terminal tab), preventing long-running commands like `serve` from becoming orphaned processes.
This commit is contained in:
Dax Raad
2026-03-21 09:54:29 -04:00
parent fb6bf0b35e
commit e1f06de263

View File

@@ -47,6 +47,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")