mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-06 07:49:49 +00:00
17 lines
391 B
TypeScript
17 lines
391 B
TypeScript
let shuttingDown = false
|
|
let signalHandlersRegistered = false
|
|
|
|
export function isShuttingDown() {
|
|
return shuttingDown
|
|
}
|
|
|
|
export function registerShutdownSignalHandlers() {
|
|
if (signalHandlersRegistered) return
|
|
signalHandlersRegistered = true
|
|
process.once("SIGTERM", markShuttingDown)
|
|
process.once("SIGINT", markShuttingDown)
|
|
}
|
|
|
|
function markShuttingDown() {
|
|
shuttingDown = true
|
|
}
|