Fix Windows stop logic

Handle the Factorio server not exiting when encountering an error on
Windows and fix the hang detection for .stop().
This commit is contained in:
Hornwitser committed 2020-05-21 18:06:20 +02:00
1 parent 87d14252fc
commit 203f2d2a14
3 files changed
+83 -19

No files matched your search

+17
View File
@@ -167,6 +167,23 @@ describe("Integration of lib/factorio/server", function() {
});
});
describe(".start() error handling", function() {
it("should handle factorio erroring out", async function() {
slowTest(this);
log(".start() for error handling");
await server.start("test.zip");
if (!server._rconReady) {
await events.once(server, "rcon-ready");
}
server.sendRcon("/c script.on_nth_tick(1, function() o.o = 1 end)").catch(() => {});
function discard() { }
server.on("error", discard);
await new Promise(resolve => server.once("exit", resolve));
server.off("error", discard);
});
});
describe(".stop() hang detection", function() {
it("should detect factorio hanging on shutdown", async function() {
slowTest(this);
+11
View File
@@ -120,6 +120,17 @@ let testLines = new Map([
message: "Saving to _autosave4 (blocking).",
}
],
[
" 10.806 Info AppManager.cpp:394: Saving game as C:\\factorio\\saves\\world.zip",
{
format: "seconds",
time: "10.806",
type: "log",
level: "Info",
file: "AppManager.cpp:394",
message: "Saving game as C:\\factorio\\saves\\world.zip",
}
],
[
"4202.780 Info AppManagerStates.cpp:1802: Saving finished",
{