restored Node 4.x compatibility

This commit is contained in:
Sebastian Hildebrandt
2021-05-05 08:47:39 +02:00
parent 52778575e7
commit a7678b478e
6 changed files with 14 additions and 4 deletions
+1 -1
View File
@@ -728,7 +728,7 @@ function graphics(callback) {
const nvidiaData = nvidiaDevices();
// needs to be rewritten ... using no spread operators
result.controllers = result.controllers.map((controller) => { // match by busAddress
return mergeControllerNvidia(controller, nvidiaData.find(({ pciBus }) => pciBus.toLowerCase().endsWith(controller.busAddress.toLowerCase())) || {});
return mergeControllerNvidia(controller, nvidiaData.find((controller) => controller.pciBus.toLowerCase().endsWith(controller.busAddress.toLowerCase())) || {});
});
}
let cmd = 'clinfo --raw';
+4 -1
View File
@@ -683,12 +683,15 @@ function testVirtualNic(iface, ifaceName, mac) {
} else { return false; }
}
function networkInterfaces(callback, rescan = true) {
function networkInterfaces(callback, rescan) {
if (typeof callback === 'boolean') {
rescan = callback;
callback = null;
}
if (typeof rescan === 'undefined') {
rescan = true;
}
return new Promise((resolve) => {
process.nextTick(() => {
let ifaces = os.networkInterfaces();
+2 -1
View File
@@ -540,7 +540,8 @@ function countLines(lines, startingWith) {
return uniqueLines.length;
}
function sanitizeShellString(str, strict = false) {
function sanitizeShellString(str, strict) {
if (typeof strict === 'undefined') { strict = false; }
const s = str || '';
let result = '';
for (let i = 0; i <= mathMin(s.length, 2000); i++) {