From 09e4256c187877aeea604455a20549f1d1fd46cc Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Tue, 1 Jun 2021 11:21:25 +0200 Subject: [PATCH] Fix hang on missing/wrong Factorio version Fix the start command hanging if the configured Factorio version for the instance started is not available on the slave. --- packages/slave/slave.js | 7 ++++++- test/integration/clusterio.js | 10 ++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/slave/slave.js b/packages/slave/slave.js index 2d057303..11fe8b83 100755 --- a/packages/slave/slave.js +++ b/packages/slave/slave.js @@ -315,7 +315,12 @@ class Instance extends libLink.Link { async init(pluginInfos) { this.notifyStatus("starting"); - await this.server.init(); + try { + await this.server.init(); + } catch (err) { + this.notifyExit(); + throw err; + } // load plugins for (let pluginInfo of pluginInfos) { diff --git a/test/integration/clusterio.js b/test/integration/clusterio.js index 3468cc3f..c73c3d32 100644 --- a/test/integration/clusterio.js +++ b/test/integration/clusterio.js @@ -173,6 +173,16 @@ describe("Integration of Clusterio", function() { }); describe("instance start", function() { + it("should not hang if factorio version does not exist", async function() { + slowTest(this); + try { + await execCtl("instance config set 44 factorio.version 0.1.2"); + await assert.rejects(execCtl("instance start test")); + + } finally { + await execCtl("instance config set 44 factorio.version latest"); + } + }); it("starts the given save", async function() { slowTest(this); await execCtl("instance start test --save world.zip");