(signal = "SIGTERM")
| 173 | let shuttingDown = false; |
| 174 | |
| 175 | const shutdown = (signal = "SIGTERM") => { |
| 176 | if (shuttingDown) { |
| 177 | return; |
| 178 | } |
| 179 | |
| 180 | shuttingDown = true; |
| 181 | signalProcessTree(backend, signal); |
| 182 | |
| 183 | setTimeout(() => { |
| 184 | if (isProcessRunning(backend)) { |
| 185 | signalProcessTree(backend, "SIGKILL"); |
| 186 | } |
| 187 | process.exit(process.exitCode ?? 0); |
| 188 | }, 3000); |
| 189 | }; |
| 190 | |
| 191 | process.on("SIGINT", () => shutdown("SIGINT")); |
| 192 | process.on("SIGTERM", () => shutdown("SIGTERM")); |
no test coverage detected