mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-13 15:14:52 +09:00
Set blocking on logging before process.exit
On windows the terminal output is asynchronous by default which leads to log lines being lost if text is written to stdout before calling process.exit. Fix by using setBlocking before doing the log call.
This commit is contained in:
1 parent
fb30499d80
commit
99fa6b4b12
2 files changed
+3
No files matched your search
@@ -1957,6 +1957,7 @@ async function startServer(args) {
|
||||
let secondSigint = false;
|
||||
process.on("SIGINT", () => {
|
||||
if (secondSigint) {
|
||||
setBlocking(true);
|
||||
logger.fatal("Caught second interrupt, terminating immediately");
|
||||
// eslint-disable-next-line no-process-exit
|
||||
process.exit(1);
|
||||
@@ -1969,6 +1970,7 @@ async function startServer(args) {
|
||||
let secondSigterm = false;
|
||||
process.on("SIGTERM", () => {
|
||||
if (secondSigterm) {
|
||||
setBlocking(true);
|
||||
logger.fatal("Caught second termination, terminating immediately");
|
||||
// eslint-disable-next-line no-process-exit
|
||||
process.exit(1);
|
||||
|
||||
@@ -1404,6 +1404,7 @@ class Slave extends libLink.Link {
|
||||
// Clear silly interval in pidfile library.
|
||||
pidusage.clear();
|
||||
} catch (err) {
|
||||
setBlocking(true);
|
||||
logger.error(`
|
||||
+--------------------------------------------------------------------+
|
||||
| Unexpected error occured while shutting down slave, please report |
|
||||
|
||||
Reference in new issue
Block a user