()
| 548 | // ═══════════════════════════════════════════════════════════════════════════ |
| 549 | |
| 550 | function shutdown() { |
| 551 | if (shuttingDown) return; |
| 552 | shuttingDown = true; |
| 553 | |
| 554 | console.log(""); |
| 555 | console.log(`${c.yellow}Shutting down...${c.reset}`); |
| 556 | |
| 557 | for (const [name, proc] of processes) { |
| 558 | logService(name, "Stopping...", c.dim); |
| 559 | signalProcessTree(proc, "SIGTERM"); |
| 560 | } |
| 561 | |
| 562 | setTimeout(() => { |
| 563 | for (const [name, proc] of processes) { |
| 564 | if (isProcessRunning(proc)) { |
| 565 | logService(name, "Force stopping...", c.dim); |
| 566 | signalProcessTree(proc, "SIGKILL"); |
| 567 | } |
| 568 | } |
| 569 | process.exit(0); |
| 570 | }, 3000); |
| 571 | } |
| 572 | |
| 573 | process.on("SIGINT", shutdown); |
| 574 | process.on("SIGTERM", shutdown); |
nothing calls this directly
no test coverage detected