| 2364 | // The http server keeps the event loop alive on its own; these just make |
| 2365 | // Ctrl-C hang up live sockets instead of waiting on browser keep-alives. |
| 2366 | const shutdown = (): void => { |
| 2367 | // Release the SQLite handle before the socket: the process should never |
| 2368 | // exit with a live connection to the user's index. |
| 2369 | api.close(); |
| 2370 | void handle.close().then(() => process.exit(0)); |
| 2371 | }; |
| 2372 | process.once('SIGINT', shutdown); |
| 2373 | process.once('SIGTERM', shutdown); |
| 2374 | // Killing the command the user started (its pid, not Ctrl+C's process |