Kill Factorio process if it's dected to hang

Send SIGKILL instead of SIGTERM when it's dectected that Factorio hangs
on shutdown.  This should hopefully resolve the travis ci hanging
issuse.
This commit is contained in:
Hornwitser committed 2019-10-28 22:30:57 +01:00
1 parent 246a8031c1
commit bdf8cd1152
1 file changed
+4 -3
+4 -3
View File
@@ -651,7 +651,8 @@ class FactorioServer extends events.EventEmitter {
// There appears to be an race condition where sending SIGTERM
// immediatly before the RCON interface comes online causes the
// Factorio server to hang. It's also possible the server doesn't
// stop if it's stuck with an infinite lua code loop.
// stop if it's stuck with an infinite lua code loop. In either
// case there's no recovering from it.
if (process.platform !== "win32") {
let hanged = true;
function setAlive(output) { hanged = false; }
@@ -659,8 +660,8 @@ class FactorioServer extends events.EventEmitter {
let timeoutId = setTimeout(() => {
if (hanged) {
console.error("Factorio appears to have hanged, sending second SIGTERM");
this._server.kill();
console.error("Factorio appears to have hanged, sending SIGKILL");
this._server.kill('SIGKILL');
}
}, 5000);