code cleanup

This commit is contained in:
Sebastian Hildebrandt 2026-01-13 21:14:33 +01:00
parent 908e7e033d
commit 12455253dd
3 changed files with 14 additions and 14 deletions

View File

@ -290,7 +290,7 @@ function users(callback) {
} }
resolve(result); resolve(result);
}); });
} catch (e) { } catch {
if (callback) { if (callback) {
callback(result); callback(result);
} }

View File

@ -23,7 +23,7 @@ function vboxInfo(callback) {
return new Promise((resolve) => { return new Promise((resolve) => {
process.nextTick(() => { process.nextTick(() => {
try { 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:'); let parts = (os.EOL + stdout.toString()).split(os.EOL + 'Name:');
parts.shift(); parts.shift();
parts.forEach((part) => { parts.forEach((part) => {
@ -38,7 +38,7 @@ function vboxInfo(callback) {
const offset = sinceDateObj.getTimezoneOffset(); const offset = sinceDateObj.getTimezoneOffset();
runningSince = Math.round((Date.now() - Date.parse(sinceDateObj)) / 1000) + offset * 60; runningSince = Math.round((Date.now() - Date.parse(sinceDateObj)) / 1000) + offset * 60;
} }
} catch (e) { } catch {
util.noop(); util.noop();
} }
const stoppedSinceString = !running ? state.replace('powered off (since', '').replace(')', '').trim() : ''; const stoppedSinceString = !running ? state.replace('powered off (since', '').replace(')', '').trim() : '';
@ -49,7 +49,7 @@ function vboxInfo(callback) {
const offset = sinceDateObj.getTimezoneOffset(); const offset = sinceDateObj.getTimezoneOffset();
stoppedSince = Math.round((Date.now() - Date.parse(sinceDateObj)) / 1000) + offset * 60; stoppedSince = Math.round((Date.now() - Date.parse(sinceDateObj)) / 1000) + offset * 60;
} }
} catch (e) { } catch {
util.noop(); util.noop();
} }
result.push({ result.push({
@ -97,7 +97,7 @@ function vboxInfo(callback) {
} }
resolve(result); resolve(result);
}); });
} catch (e) { } catch {
if (callback) { if (callback) {
callback(result); callback(result);
} }

View File

@ -157,7 +157,7 @@ function ifaceListLinux() {
}); });
}); });
return result; return result;
} catch (e) { } catch {
try { 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 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'); const parts = all.split('\n\n');
@ -179,7 +179,7 @@ function ifaceListLinux() {
} }
}); });
return result; return result;
} catch (e) { } catch {
return []; return [];
} }
} }
@ -198,7 +198,7 @@ function nmiDeviceLinux(iface) {
mac: util.getValue(lines, 'GENERAL.HWADDR').toLowerCase(), mac: util.getValue(lines, 'GENERAL.HWADDR').toLowerCase(),
ssid: ssid !== '--' ? ssid : null ssid: ssid !== '--' ? ssid : null
}; };
} catch (e) { } catch {
return {}; return {};
} }
} }
@ -216,7 +216,7 @@ function nmiConnectionLinux(ssid) {
security: util.getValue(lines, '802-11-wireless-security.key-mgmt'), security: util.getValue(lines, '802-11-wireless-security.key-mgmt'),
bssid: bssid !== '--' ? bssid : null bssid: bssid !== '--' ? bssid : null
}; };
} catch (e) { } catch {
return {}; return {};
} }
} }
@ -237,7 +237,7 @@ function wpaConnectionLinux(iface) {
channel: wifiChannelFromFrequencs(freq), channel: wifiChannelFromFrequencs(freq),
bssid: util.getValue(lines, 'bssid', '=').toLowerCase() bssid: util.getValue(lines, 'bssid', '=').toLowerCase()
}; };
} catch (e) { } catch {
return {}; return {};
} }
} }
@ -272,7 +272,7 @@ function getWifiNetworkListNmi() {
}); });
}); });
return result; return result;
} catch (e) { } catch {
return []; return [];
} }
} }
@ -363,7 +363,7 @@ function getWifiNetworkListIw(iface) {
}); });
} }
return result; return result;
} catch (e) { } catch {
return -1; return -1;
} }
} }
@ -404,7 +404,7 @@ function parseWifiDarwin(wifiStr) {
}); });
}); });
return result; return result;
} catch (e) { } catch {
return result; return result;
} }
} }
@ -460,7 +460,7 @@ function wifiNetworks(callback) {
} }
resolve(result); resolve(result);
} }
} catch (e) { } catch {
if (callback) { if (callback) {
callback(result); callback(result);
} }