| 2443 | // The http server keeps the event loop alive on its own; these just make |
| 2444 | // Ctrl-C hang up live sockets instead of waiting on browser keep-alives. |
| 2445 | const shutdown = (): void => { |
| 2446 | // Release the SQLite handle before the socket: the process should never |
| 2447 | // exit with a live connection to the user's index. |
| 2448 | api.close(); |
| 2449 | void handle.close().then(() => process.exit(0)); |
| 2450 | }; |
| 2451 | process.once('SIGINT', shutdown); |
| 2452 | process.once('SIGTERM', shutdown); |
| 2453 | // Killing the command the user started (its pid, not Ctrl+C's process |