(signal = "SIGTERM")
| 908 | let frontend = null; |
| 909 | |
| 910 | const shutdown = (signal = "SIGTERM") => { |
| 911 | if (shuttingDown) { |
| 912 | return; |
| 913 | } |
| 914 | |
| 915 | shuttingDown = true; |
| 916 | if (frontend) { |
| 917 | signalProcessTree(frontend, signal); |
| 918 | } |
| 919 | signalProcessTree(backend, signal); |
| 920 | |
| 921 | setTimeout(() => { |
| 922 | if (frontend && isProcessRunning(frontend)) { |
| 923 | signalProcessTree(frontend, "SIGKILL"); |
| 924 | } |
| 925 | if (isProcessRunning(backend)) { |
| 926 | signalProcessTree(backend, "SIGKILL"); |
| 927 | } |
| 928 | process.exit(process.exitCode ?? 0); |
| 929 | }, 3000); |
| 930 | }; |
| 931 | |
| 932 | process.on("SIGINT", () => shutdown("SIGINT")); |
| 933 | process.on("SIGTERM", () => shutdown("SIGTERM")); |
no test coverage detected