Merge pull request #28 from gnmyt/fixes/windows-fix

🐛 Fehler mit CLI unter Windows behoben
This commit is contained in:
Mathias Wagner
2022-08-10 01:13:56 +02:00
committed by GitHub
2 changed files with 3 additions and 3 deletions

View File

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

View File

@@ -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}`);