MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / shutdown

Function shutdown

scripts/dev-static.mjs:473–494  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

471// ═══════════════════════════════════════════════════════════════════════════
472
473function shutdown() {
474 if (shuttingDown) return;
475 shuttingDown = true;
476
477 console.log("");
478 console.log(`${c.yellow}Shutting down...${c.reset}`);
479
480 for (const [name, proc] of processes) {
481 logService(name, "Stopping...", c.dim);
482 signalProcessTree(proc, "SIGTERM");
483 }
484
485 setTimeout(() => {
486 for (const [name, proc] of processes) {
487 if (isProcessRunning(proc)) {
488 logService(name, "Force stopping...", c.dim);
489 signalProcessTree(proc, "SIGKILL");
490 }
491 }
492 process.exit(0);
493 }, 3000);
494}
495
496process.on("SIGINT", shutdown);
497process.on("SIGTERM", shutdown);

Callers

nothing calls this directly

Calls 3

signalProcessTreeFunction · 0.90
isProcessRunningFunction · 0.90
logServiceFunction · 0.70

Tested by

no test coverage detected