Skip to content

Commit bcca192

Browse files
committed
fix: add SIGQUIT handler and unref timeout
1 parent c8e99cb commit bcca192

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

packages/opencode/src/signal.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const SIGNAL_EXIT_CODES: Record<string, number> = {
77
SIGTERM: 128 + 15,
88
SIGINT: 128 + 2,
99
SIGHUP: 128 + 1,
10+
SIGQUIT: 128 + 3,
1011
}
1112

1213
let shuttingDown = false
@@ -25,6 +26,7 @@ async function gracefulShutdown(signal: string) {
2526
})
2627
process.exit(SIGNAL_EXIT_CODES[signal] ?? 1)
2728
}, SHUTDOWN_TIMEOUT_MS)
29+
timeout.unref()
2830

2931
try {
3032
await Instance.disposeAll()
@@ -37,7 +39,7 @@ async function gracefulShutdown(signal: string) {
3739
}
3840

3941
export function registerSignalHandlers() {
40-
for (const signal of ["SIGTERM", "SIGINT", "SIGHUP"]) {
42+
for (const signal of ["SIGTERM", "SIGINT", "SIGHUP", "SIGQUIT"]) {
4143
process.on(signal, () => {
4244
void gracefulShutdown(signal)
4345
})

0 commit comments

Comments
 (0)