fix(server): close Python backend and exit when stdin closes

This commit is contained in:
Stefano Baldo
2026-05-30 13:08:24 -03:00
parent 5493a37024
commit c6395ed0b1

View File

@@ -64,6 +64,12 @@ function parseCommandLineArgs(args: string[]) {
* Setup graceful shutdown handlers
*/
function setupGracefulShutdown(server: KiCADMcpServer) {
// Handle stdin close (EOF) when parent process exits
process.stdin.on("close", async () => {
logger.info("process.stdin closed. Shutting down...");
await shutdownServer(server);
});
// Handle termination signals
process.on("SIGINT", async () => {
logger.info("Received SIGINT signal. Shutting down...");