Handle SIGHUP gracefully

Invoke shutdown instead of exiting immediately when SIGHUP is received,
and do the same on both slave and master for signals received.
This commit is contained in:
Hornwitser committed 2021-02-17 17:49:54 +01:00
1 parent 4ca092f351
commit 9660fa0801
2 files changed
+7 -7

No files matched your search

+2 -6
View File
@@ -1985,13 +1985,9 @@ async function startServer(args) {
logger.info("Caught termination signal, shutting down");
shutdown();
});
// terminal closed
process.on("SIGHUP", () => {
// No graceful cleanup, no warning out (stdout is likely closed.)
// Don't close the terminal with the clusterio master in it.
// eslint-disable-next-line no-process-exit
process.exit(1);
logger.info("Terminal closed, shutting down");
shutdown();
});
await fs.ensureDir(masterConfig.get("master.database_directory"));