()
| 471 | // ═══════════════════════════════════════════════════════════════════════════ |
| 472 | |
| 473 | function 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 | |
| 496 | process.on("SIGINT", shutdown); |
| 497 | process.on("SIGTERM", shutdown); |
nothing calls this directly
no test coverage detected