Skip to content

Commit

Permalink
fix(speedtest): not working on windows install (#731)
Browse files Browse the repository at this point in the history
fixes #729
  • Loading branch information
MauriceNino authored May 1, 2023
1 parent ff50bf8 commit 423837b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion apps/server/src/data/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@ import * as si from 'systeminformation';
import { promisify } from 'util';
import { CONFIG } from '../config';
import { NET_INTERFACE_PATH } from '../setup';
import { getStaticServerInfo } from '../static-info';
import { platformIsWindows } from '../utils';

const exec = promisify(cexec);

const commandExists = async (command: string): Promise<boolean> => {
try {
const { stdout, stderr } = await exec(`which ${command}`);
const svInfo = getStaticServerInfo();
const { stdout, stderr } = await exec(
`${platformIsWindows(svInfo.os.platform) ? 'where' : 'which'} ${command}`
);
return stderr === '' && stdout.trim() !== '';
} catch (e) {
return false;
Expand Down Expand Up @@ -93,6 +98,7 @@ export default {
} else {
const networkInfo = await si.networkInterfaces();
//@ts-ignore
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const defaultNet = networkInfo.find(net => net.default)!;

return {
Expand Down

0 comments on commit 423837b

Please sign in to comment.