mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-13 15:14:52 +09:00
Added TERM signal handler
This commit is contained in:
1 parent
e944364fc2
commit
40bd3edb32
1 file changed
+12
@@ -1966,6 +1966,18 @@ async function startServer(args) {
|
||||
logger.info("Caught interrupt signal, shutting down");
|
||||
shutdown();
|
||||
});
|
||||
let secondSigterm = false;
|
||||
process.on("SIGTERM", () => {
|
||||
if (secondSigterm) {
|
||||
logger.fatal("Caught second termination, terminating immediately");
|
||||
// eslint-disable-next-line no-process-exit
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
secondSigterm = true;
|
||||
logger.info("Caught termination signal, shutting down");
|
||||
shutdown();
|
||||
});
|
||||
|
||||
// terminal closed
|
||||
process.on("SIGHUP", () => {
|
||||
|
||||
Reference in new issue
Block a user