()
| 488 | // ═══════════════════════════════════════════════════════════════════════════ |
| 489 | |
| 490 | function shutdown() { |
| 491 | if (shuttingDown) return; |
| 492 | shuttingDown = true; |
| 493 | |
| 494 | console.log(""); |
| 495 | console.log(`${c.yellow}Shutting down...${c.reset}`); |
| 496 | |
| 497 | for (const [name, proc] of processes) { |
| 498 | logService(name, "Stopping...", c.dim); |
| 499 | signalProcessTree(proc, "SIGTERM"); |
| 500 | } |
| 501 | |
| 502 | setTimeout(() => { |
| 503 | for (const [name, proc] of processes) { |
| 504 | if (isProcessRunning(proc)) { |
| 505 | logService(name, "Force stopping...", c.dim); |
| 506 | signalProcessTree(proc, "SIGKILL"); |
| 507 | } |
| 508 | } |
| 509 | process.exit(0); |
| 510 | }, 3000); |
| 511 | } |
| 512 | |
| 513 | process.on("SIGINT", shutdown); |
| 514 | process.on("SIGTERM", shutdown); |
nothing calls this directly
no test coverage detected