From 950186128565455813ca9e66e333f22dc91d048f Mon Sep 17 00:00:00 2001 From: chrisgbk Date: Tue, 10 Jul 2018 04:23:40 -0600 Subject: [PATCH 1/2] Fix race condition in node client download Fix race condition in node client download --- client.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client.js b/client.js index f638e727..c3474a36 100644 --- a/client.js +++ b/client.js @@ -245,10 +245,12 @@ if (!command || command == "help" || command == "--help") { console.log(url); let file = fs.createWriteStream("sharedMods/"+name); https.get(url, function(response) { + response.on('end', function () { + console.log("Downloaded "+name); + process.exit(0); + }); response.pipe(file); - console.log("Downloaded "+name); - process.exit(0); - }); + }).end(); } } else if (command == "start" && instance === undefined) { console.log("ERROR: No instanceName provided!"); From af42b1fcd3cfe00101469e7d19cf9da5d4f89600 Mon Sep 17 00:00:00 2001 From: hintss Date: Fri, 13 Jul 2018 01:36:12 -0700 Subject: [PATCH 2/2] fix typo in log message --- client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client.js b/client.js index c3474a36..446d0853 100644 --- a/client.js +++ b/client.js @@ -638,7 +638,7 @@ function instanceManagement() { console.log("##### getMac crashed, but we don't really give a shit because we are probably closing down #####"); } payload.mac = mac; - console.log("Registered our precense with master "+config.masterIP+" at " + payload.time); + console.log("Registered our presence with master "+config.masterIP+" at " + payload.time); needle.post(config.masterIP + ":" + config.masterPort + '/api/getID', payload, needleOptionsWithTokenAuthHeader, function (err, response, body) { if (err && err.code != "ECONNRESET"){ console.error("We got problems, something went wrong when contacting master");