From 31ac1ed19162fde59fc3df52e249eed9b6a9462f Mon Sep 17 00:00:00 2001 From: Simon Knott Date: Mon, 7 Apr 2025 23:51:57 +0200 Subject: [PATCH] fix: exit watchdog should listen for SIGINT/SIGTERM (#144) --- src/program.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/program.ts b/src/program.ts index 5272b61..fe4e957 100644 --- a/src/program.ts +++ b/src/program.ts @@ -100,11 +100,15 @@ program }); function setupExitWatchdog(serverList: ServerList) { - process.stdin.on('close', async () => { + const handleExit = async () => { setTimeout(() => process.exit(0), 15000); await serverList.closeAll(); process.exit(0); - }); + }; + + process.stdin.on('close', handleExit); + process.on('SIGINT', handleExit); + process.on('SIGTERM', handleExit); } program.parse(process.argv);