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);