Add double interrupt logic to ctl to force exit

This commit is contained in:
Cooldude2606 committed 2026-04-12 22:37:50 +01:00
1 parent fc05b229f1
commit e9653c13eb
1 file changed
+7 -1
+7 -1
View File
@@ -311,12 +311,18 @@ async function startControl() {
throw err;
}
let caughtSigInt = false;
process.on("SIGINT", () => {
if (caughtSigInt) {
logger.info("Caught second interrupt signal, forcing disconnect");
process.exit(1);
}
caughtSigInt = true;
logger.info("Caught interrupt signal, closing connection");
control.shutdown().catch(err => {
setBlocking(true);
logger.error(err.stack);
process.exit(1);
});
});