MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / shutdown

Function shutdown

apps/cli/src/commands/cli/run.ts:471–493  ·  view source on GitHub ↗
(signal: string, exitCode: number)

Source from the content-addressed store, hash-verified

469 }
470
471 async function shutdown(signal: string, exitCode: number): Promise<void> {
472 if (isShuttingDown) {
473 return
474 }
475
476 isShuttingDown = true
477 process.off("SIGINT", onSigint)
478 process.off("SIGTERM", onSigterm)
479 process.off("uncaughtException", onUncaughtException)
480 process.off("unhandledRejection", onUnhandledRejection)
481 clearKeepAliveInterval()
482
483 if (!useJsonOutput) {
484 console.log(`\n[CLI] Received ${signal}, shutting down...`)
485 }
486
487 await disposeHost()
488 if (jsonEmitter) {
489 await jsonEmitter.flush()
490 }
491 await flushStdout()
492 process.exit(exitCode)
493 }
494
495 process.on("SIGINT", onSigint)
496 process.on("SIGTERM", onSigterm)

Callers 4

onSigintFunction · 0.70
onSigtermFunction · 0.70
onUncaughtExceptionFunction · 0.70
onUnhandledRejectionFunction · 0.70

Calls 6

clearKeepAliveIntervalFunction · 0.85
disposeHostFunction · 0.85
flushStdoutFunction · 0.85
offMethod · 0.65
logMethod · 0.65
flushMethod · 0.65

Tested by

no test coverage detected