code cleanup
This commit is contained in:
parent
908e7e033d
commit
12455253dd
@ -290,7 +290,7 @@ function users(callback) {
|
||||
}
|
||||
resolve(result);
|
||||
});
|
||||
} catch (e) {
|
||||
} catch {
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ function vboxInfo(callback) {
|
||||
return new Promise((resolve) => {
|
||||
process.nextTick(() => {
|
||||
try {
|
||||
exec(util.getVboxmanage() + ' list vms --long', function (error, stdout) {
|
||||
exec(util.getVboxmanage() + ' list vms --long', (error, stdout) => {
|
||||
let parts = (os.EOL + stdout.toString()).split(os.EOL + 'Name:');
|
||||
parts.shift();
|
||||
parts.forEach((part) => {
|
||||
@ -38,7 +38,7 @@ function vboxInfo(callback) {
|
||||
const offset = sinceDateObj.getTimezoneOffset();
|
||||
runningSince = Math.round((Date.now() - Date.parse(sinceDateObj)) / 1000) + offset * 60;
|
||||
}
|
||||
} catch (e) {
|
||||
} catch {
|
||||
util.noop();
|
||||
}
|
||||
const stoppedSinceString = !running ? state.replace('powered off (since', '').replace(')', '').trim() : '';
|
||||
@ -49,7 +49,7 @@ function vboxInfo(callback) {
|
||||
const offset = sinceDateObj.getTimezoneOffset();
|
||||
stoppedSince = Math.round((Date.now() - Date.parse(sinceDateObj)) / 1000) + offset * 60;
|
||||
}
|
||||
} catch (e) {
|
||||
} catch {
|
||||
util.noop();
|
||||
}
|
||||
result.push({
|
||||
@ -97,7 +97,7 @@ function vboxInfo(callback) {
|
||||
}
|
||||
resolve(result);
|
||||
});
|
||||
} catch (e) {
|
||||
} catch {
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
|
||||
18
lib/wifi.js
18
lib/wifi.js
@ -157,7 +157,7 @@ function ifaceListLinux() {
|
||||
});
|
||||
});
|
||||
return result;
|
||||
} catch (e) {
|
||||
} catch {
|
||||
try {
|
||||
const all = execSync('nmcli -t -f general,wifi-properties,wired-properties,interface-flags,capabilities,nsp device show 2>/dev/null', util.execOptsLinux).toString();
|
||||
const parts = all.split('\n\n');
|
||||
@ -179,7 +179,7 @@ function ifaceListLinux() {
|
||||
}
|
||||
});
|
||||
return result;
|
||||
} catch (e) {
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@ -198,7 +198,7 @@ function nmiDeviceLinux(iface) {
|
||||
mac: util.getValue(lines, 'GENERAL.HWADDR').toLowerCase(),
|
||||
ssid: ssid !== '--' ? ssid : null
|
||||
};
|
||||
} catch (e) {
|
||||
} catch {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
@ -216,7 +216,7 @@ function nmiConnectionLinux(ssid) {
|
||||
security: util.getValue(lines, '802-11-wireless-security.key-mgmt'),
|
||||
bssid: bssid !== '--' ? bssid : null
|
||||
};
|
||||
} catch (e) {
|
||||
} catch {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
@ -237,7 +237,7 @@ function wpaConnectionLinux(iface) {
|
||||
channel: wifiChannelFromFrequencs(freq),
|
||||
bssid: util.getValue(lines, 'bssid', '=').toLowerCase()
|
||||
};
|
||||
} catch (e) {
|
||||
} catch {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
@ -272,7 +272,7 @@ function getWifiNetworkListNmi() {
|
||||
});
|
||||
});
|
||||
return result;
|
||||
} catch (e) {
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@ -363,7 +363,7 @@ function getWifiNetworkListIw(iface) {
|
||||
});
|
||||
}
|
||||
return result;
|
||||
} catch (e) {
|
||||
} catch {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -404,7 +404,7 @@ function parseWifiDarwin(wifiStr) {
|
||||
});
|
||||
});
|
||||
return result;
|
||||
} catch (e) {
|
||||
} catch {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -460,7 +460,7 @@ function wifiNetworks(callback) {
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
} catch (e) {
|
||||
} catch {
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user