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