()
| 99 | } |
| 100 | |
| 101 | function shutdown() { |
| 102 | shuttingDown = true; |
| 103 | clearTimeout(restartTimer); |
| 104 | if (!child) return process.exit(0); |
| 105 | |
| 106 | child.once("exit", () => process.exit(0)); |
| 107 | child.kill("SIGTERM"); |
| 108 | setTimeout(() => process.exit(1), 3000).unref(); |
| 109 | } |
| 110 | |
| 111 | for (const signal of ["SIGINT", "SIGTERM"]) { |
| 112 | process.on(signal, shutdown); |