mirror of
https://github.com/gnmyt/myspeed.git
synced 2026-02-14 01:28:39 -06:00
Merge pull request #28 from gnmyt/fixes/windows-fix
🐛 Fehler mit CLI unter Windows behoben
This commit is contained in:
@@ -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;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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}`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user