mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-23 08:23:12 +09:00
Add double interrupt logic to ctl to force exit
This commit is contained in:
1 file changed
+7
-1
+7
-1
@@ -311,12 +311,18 @@ async function startControl() {
|
|||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let caughtSigInt = false;
|
||||||
process.on("SIGINT", () => {
|
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");
|
logger.info("Caught interrupt signal, closing connection");
|
||||||
control.shutdown().catch(err => {
|
control.shutdown().catch(err => {
|
||||||
setBlocking(true);
|
setBlocking(true);
|
||||||
logger.error(err.stack);
|
logger.error(err.stack);
|
||||||
|
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user