fix: exit watchdog should listen for SIGINT/SIGTERM (#144)

This commit is contained in:
Simon Knott 2025-04-07 23:51:57 +02:00 committed by GitHub
parent b8ff009b0a
commit 31ac1ed191
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);