From 59cf524e8372760c5917248a8583387912233388 Mon Sep 17 00:00:00 2001 From: Mathias Date: Wed, 10 Aug 2022 01:06:05 +0200 Subject: [PATCH 1/2] The cli now downloads as an .exe on windows --- server/config/loadCli.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/config/loadCli.js b/server/config/loadCli.js index 46ab7a2d..7137de7b 100644 --- a/server/config/loadCli.js +++ b/server/config/loadCli.js @@ -8,7 +8,7 @@ const binaries = require('./binaries'); const binaryRegex = /speedtest(.exe)?$/; const binaryDirectory = __dirname + "/../../bin/"; -const binaryPath = `${binaryDirectory}/speedtest`; +const binaryPath = `${binaryDirectory}/speedtest` + (process.platform === "win32" ? ".exe" : ""); const downloadPath = `https://install.speedtest.net/app/cli/ookla-speedtest-${binaries.version}-`; @@ -28,7 +28,7 @@ module.exports.downloadFile = async () => { plugins: [decompressTarGz(), decompressUnzip()], filter: file => binaryRegex.test(file.path), map: file => { - file.path = "speedtest"; + file.path = "speedtest" + (process.platform === "win32" ? ".exe" : ""); return file; } }); From 85a774ddcf5d6aa1a65de526c466156763c0f18f Mon Sep 17 00:00:00 2001 From: Mathias Date: Wed, 10 Aug 2022 01:06:22 +0200 Subject: [PATCH 2/2] The cli now executes as an .exe on windows --- server/util/speedtest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/util/speedtest.js b/server/util/speedtest.js index 070d24cf..9301f49a 100644 --- a/server/util/speedtest.js +++ b/server/util/speedtest.js @@ -1,6 +1,6 @@ const {spawn} = require('child_process'); -module.exports = async (serverId, binary_path = './bin/speedtest') => { +module.exports = async (serverId, binary_path = './bin/speedtest' + (process.platform === "win32" ? ".exe" : "")) => { const args = ['--accept-license', '--accept-gdpr', '--format=jsonl']; if (serverId) args.push(`--server-id=${serverId}`);