diff --git a/CHANGELOG.md b/CHANGELOG.md index 4464aa80..5bc836da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -83,6 +83,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page. | Version | Date | Comment | | ------- | ---------- | --------------------------------------------------------------------------------------------------- | +| 5.23.2 | 2024-08-01 | `execSync()` fixed EFAULT (linux) | | 5.23.1 | 2024-07-31 | `disklayout()` updated docs (macOS) | | 5.23.0 | 2024-07-31 | `usb()` added serialNumber (linux) | | 5.22.11 | 2024-06-10 | `osInfo()` added macOS Sequoia | diff --git a/docs/history.html b/docs/history.html index 086a2ae3..e555059b 100644 --- a/docs/history.html +++ b/docs/history.html @@ -57,6 +57,11 @@

Full version history

+ + 5.23.2 + 2024-08-01 + execSync() fixed EFAULT (linux) + 5.23.1 2024-07-31 diff --git a/docs/index.html b/docs/index.html index 50b08349..42fc5d23 100644 --- a/docs/index.html +++ b/docs/index.html @@ -170,7 +170,7 @@
systeminformation
 
-
New Version: 5.23.1
+
New Version: 5.23.2
diff --git a/lib/audio.js b/lib/audio.js index b5ec92e6..4d80aaeb 100644 --- a/lib/audio.js +++ b/lib/audio.js @@ -59,7 +59,7 @@ function getLinuxAudioPci() { let cmd = 'lspci -v 2>/dev/null'; let result = []; try { - const parts = execSync(cmd).toString().split('\n\n'); + const parts = execSync(cmd, util.execOptsLinux).toString().split('\n\n'); parts.forEach(element => { const lines = element.split('\n'); if (lines && lines.length && lines[0].toLowerCase().indexOf('audio') >= 0) { diff --git a/lib/bluetooth.js b/lib/bluetooth.js index 5449ac87..d01c32ce 100644 --- a/lib/bluetooth.js +++ b/lib/bluetooth.js @@ -129,7 +129,7 @@ function bluetoothDevices(callback) { }); // determine "connected" with hcitool con try { - const hdicon = execSync('hcitool con').toString().toLowerCase(); + const hdicon = execSync('hcitool con', util.execOptsLinux).toString().toLowerCase(); for (let i = 0; i < result.length; i++) { if (result[i].macDevice && result[i].macDevice.length > 10 && hdicon.indexOf(result[i].macDevice.toLowerCase()) >= 0) { result[i].connected = true; diff --git a/lib/cpu.js b/lib/cpu.js index dfe25d5c..4fc146e1 100644 --- a/lib/cpu.js +++ b/lib/cpu.js @@ -1049,7 +1049,7 @@ function cpuTemperature(callback) { // CPU Chipset, Socket try { const cmd = 'cat /sys/class/thermal/thermal_zone*/type 2>/dev/null; echo "-----"; cat /sys/class/thermal/thermal_zone*/temp 2>/dev/null;'; - const parts = execSync(cmd).toString().split('-----\n'); + const parts = execSync(cmd, util.execOptsLinux).toString().split('-----\n'); if (parts.length === 2) { const lines = parts[0].split('\n'); const lines2 = parts[1].split('\n'); @@ -1605,7 +1605,7 @@ function getLoad() { // linux: try to get other cpu stats if (_linux) { try { - const lines = execSync('cat /proc/stat 2>/dev/null | grep cpu', { encoding: 'utf8' }).toString().split('\n'); + const lines = execSync('cat /proc/stat 2>/dev/null | grep cpu', util.execOptsLinux).toString().split('\n'); if (lines.length > 1) { lines.shift(); if (lines.length === cpus.length) { diff --git a/lib/filesystem.js b/lib/filesystem.js index 1128fa0a..15e6a87e 100644 --- a/lib/filesystem.js +++ b/lib/filesystem.js @@ -139,7 +139,7 @@ function fsSize(drive, callback) { if (_linux) { try { cmd = 'export LC_ALL=C; df -lkPTx squashfs; unset LC_ALL'; - execSync('cat /proc/mounts 2>/dev/null').toString().split('\n').filter(line => { + execSync('cat /proc/mounts 2>/dev/null', util.execOptsLinux).toString().split('\n').filter(line => { return line.startsWith('/'); }).forEach((line) => { osMounts[line.split(' ')[0]] = osMounts[line.split(' ')[0]] || false; @@ -426,7 +426,7 @@ function raidMatchLinux(data) { try { data.forEach(element => { if (element.type.startsWith('raid')) { - const lines = execSync(`mdadm --export --detail /dev/${element.name}`).toString().split('\n'); + const lines = execSync(`mdadm --export --detail /dev/${element.name}`, util.execOptsLinux).toString().split('\n'); const mdData = decodeMdabmData(lines); element.label = mdData.label; // <- assign label info @@ -1087,7 +1087,7 @@ function diskLayout(callback) { } catch (e) { // fallback to older version of lsblk try { - const out2 = execSync('export LC_ALL=C; lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,LABEL,MODEL,OWNER,GROUP 2>/dev/null; unset LC_ALL').toString(); + const out2 = execSync('export LC_ALL=C; lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,LABEL,MODEL,OWNER,GROUP 2>/dev/null; unset LC_ALL', util.execOptsLinux).toString(); let lines = blkStdoutToObject(out2).split('\n'); const data = parseBlk(lines); devices = data.filter(item => { return (item.type === 'disk') && item.size > 0 && ((item.model !== null && item.model !== '') || (item.mount === '' && item.label === '' && item.fsType === '')); }); @@ -1100,7 +1100,7 @@ function diskLayout(callback) { const BSDName = '/dev/' + device.name; const logical = device.name; try { - mediumType = execSync('cat /sys/block/' + logical + '/queue/rotational 2>/dev/null').toString().split('\n')[0]; + mediumType = execSync('cat /sys/block/' + logical + '/queue/rotational 2>/dev/null', util.execOptsLinux).toString().split('\n')[0]; } catch (e) { util.noop(); } diff --git a/lib/graphics.js b/lib/graphics.js index 0cc7a0fc..07904668 100644 --- a/lib/graphics.js +++ b/lib/graphics.js @@ -216,7 +216,7 @@ function graphics(callback) { // PCI bus IDs let pciIDs = []; try { - pciIDs = execSync('export LC_ALL=C; dmidecode -t 9 2>/dev/null; unset LC_ALL | grep "Bus Address: "').toString().split('\n'); + pciIDs = execSync('export LC_ALL=C; dmidecode -t 9 2>/dev/null; unset LC_ALL | grep "Bus Address: "', util.execOptsLinux).toString().split('\n'); for (let i = 0; i < pciIDs.length; i++) { pciIDs[i] = pciIDs[i].replace('Bus Address:', '').replace('0000:', '').trim(); } @@ -421,6 +421,9 @@ function graphics(callback) { if (nvidiaSmiExe) { const nvidiaSmiOpts = '--query-gpu=driver_version,pci.sub_device_id,name,pci.bus_id,fan.speed,memory.total,memory.used,memory.free,utilization.gpu,utilization.memory,temperature.gpu,temperature.memory,power.draw,power.limit,clocks.gr,clocks.mem --format=csv,noheader,nounits'; const cmd = nvidiaSmiExe + ' ' + nvidiaSmiOpts + (_linux ? ' 2>/dev/null' : ''); + if (_linux) { + options.stdio = ['pipe', 'pipe', 'ignore']; + } try { const res = execSync(cmd, options).toString(); return res; diff --git a/lib/memory.js b/lib/memory.js index f98c5ac5..d70a44f7 100644 --- a/lib/memory.js +++ b/lib/memory.js @@ -399,7 +399,7 @@ function memLayout(callback) { // Try Raspberry PI try { - let stdout = execSync('cat /proc/cpuinfo 2>/dev/null'); + let stdout = execSync('cat /proc/cpuinfo 2>/dev/null', util.execOptsLinux); let lines = stdout.toString().split('\n'); let model = util.getValue(lines, 'hardware', ':', true).toUpperCase(); let version = util.getValue(lines, 'revision', ':', true).toLowerCase(); @@ -419,14 +419,14 @@ function memLayout(callback) { result[0].clockSpeed = version && version[4] && version[4] === 'd' ? 500 : result[0].clockSpeed; result[0].formFactor = 'SoC'; - stdout = execSync('vcgencmd get_config sdram_freq 2>/dev/null'); + stdout = execSync('vcgencmd get_config sdram_freq 2>/dev/null', util.execOptsLinux); lines = stdout.toString().split('\n'); let freq = parseInt(util.getValue(lines, 'sdram_freq', '=', true), 10) || 0; if (freq) { result[0].clockSpeed = freq; } - stdout = execSync('vcgencmd measure_volts sdram_p 2>/dev/null'); + stdout = execSync('vcgencmd measure_volts sdram_p 2>/dev/null', util.execOptsLinux); lines = stdout.toString().split('\n'); let voltage = parseFloat(util.getValue(lines, 'volt', '=', true)) || 0; if (voltage) { diff --git a/lib/network.js b/lib/network.js index c779fe37..86c45131 100644 --- a/lib/network.js +++ b/lib/network.js @@ -91,7 +91,7 @@ function getDefaultNetworkInterface() { } if (_linux) { let cmd = 'ip route 2> /dev/null | grep default'; - let result = execSync(cmd); + let result = execSync(cmd, util.execOptsLinux); let parts = result.toString().split('\n')[0].split(/\s+/); if (parts[0] === 'none' && parts[5]) { ifacename = parts[5]; @@ -130,7 +130,7 @@ function getMacAddresses() { if (_linux || _freebsd || _openbsd || _netbsd) { if (typeof pathToIp === 'undefined') { try { - const lines = execSync('which ip').toString().split('\n'); + const lines = execSync('which ip', util.execOptsLinux).toString().split('\n'); if (lines.length && lines[0].indexOf(':') === -1 && lines[0].indexOf('/') === 0) { pathToIp = lines[0]; } else { @@ -142,7 +142,7 @@ function getMacAddresses() { } try { const cmd = 'export LC_ALL=C; ' + ((pathToIp) ? pathToIp + ' link show up' : '/sbin/ifconfig') + '; unset LC_ALL'; - let res = execSync(cmd); + let res = execSync(cmd, util.execOptsLinux); const lines = res.toString().split('\n'); for (let i = 0; i < lines.length; i++) { if (lines[i] && lines[i][0] !== ' ') { @@ -511,7 +511,7 @@ function getLinuxIfaceConnectionName(interfaceName) { const cmd = `nmcli device status 2>/dev/null | grep ${interfaceName}`; try { - const result = execSync(cmd).toString(); + const result = execSync(cmd, util.execOptsLinux).toString(); const resultFormat = result.replace(/\s+/g, ' ').trim(); const connectionNameLines = resultFormat.split(' ').slice(3); const connectionName = connectionNameLines.join(' '); @@ -525,7 +525,7 @@ function checkLinuxDCHPInterfaces(file) { let result = []; try { let cmd = `cat ${file} 2> /dev/null | grep 'iface\\|source'`; - const lines = execSync(cmd, { maxBuffer: 1024 * 20000 }).toString().split('\n'); + const lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); lines.forEach(line => { const parts = line.replace(/\s+/g, ' ').trim().split(' '); @@ -550,7 +550,7 @@ function getLinuxDHCPNics() { let cmd = 'ip a 2> /dev/null'; let result = []; try { - const lines = execSync(cmd, { maxBuffer: 1024 * 20000 }).toString().split('\n'); + const lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); const nsections = splitSectionsNics(lines); result = (parseLinuxDHCPNics(nsections)); } catch (e) { @@ -591,7 +591,7 @@ function getLinuxIfaceDHCPstatus(iface, connectionName, DHCPNics) { if (connectionName) { const cmd = `nmcli connection show "${connectionName}" 2>/dev/null | grep ipv4.method;`; try { - const lines = execSync(cmd).toString(); + const lines = execSync(cmd, util.execOptsLinux).toString(); const resultFormat = lines.replace(/\s+/g, ' ').trim(); let dhcStatus = resultFormat.split(' ').slice(1).toString(); @@ -631,7 +631,7 @@ function getLinuxIfaceDNSsuffix(connectionName) { if (connectionName) { const cmd = `nmcli connection show "${connectionName}" 2>/dev/null | grep ipv4.dns-search;`; try { - const result = execSync(cmd).toString(); + const result = execSync(cmd, util.execOptsLinux).toString(); const resultFormat = result.replace(/\s+/g, ' ').trim(); const dnsSuffix = resultFormat.split(' ').slice(1).toString(); return dnsSuffix == '--' ? 'Not defined' : dnsSuffix; @@ -647,7 +647,7 @@ function getLinuxIfaceIEEE8021xAuth(connectionName) { if (connectionName) { const cmd = `nmcli connection show "${connectionName}" 2>/dev/null | grep 802-1x.eap;`; try { - const result = execSync(cmd).toString(); + const result = execSync(cmd, util.execOptsLinux).toString(); const resultFormat = result.replace(/\s+/g, ' ').trim(); const authenticationProtocol = resultFormat.split(' ').slice(1).toString(); @@ -875,7 +875,7 @@ function networkInterfaces(callback, rescan, defaultString) { let lines = []; try { - lines = execSync(cmd).toString().split('\n'); + lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); const connectionName = getLinuxIfaceConnectionName(ifaceSanitized); dhcp = getLinuxIfaceDHCPstatus(ifaceSanitized, connectionName, _dhcpNics); dnsSuffix = getLinuxIfaceDNSsuffix(connectionName); diff --git a/lib/osinfo.js b/lib/osinfo.js index 74085d3a..33aa0c15 100644 --- a/lib/osinfo.js +++ b/lib/osinfo.js @@ -168,13 +168,13 @@ function getFQDN() { let fqdn = os.hostname; if (_linux || _darwin) { try { - const stdout = execSync('hostnamectl --json short 2>/dev/null'); + const stdout = execSync('hostnamectl --json short 2>/dev/null', util.execOptsLinux); const json = JSON.parse(stdout.toString()); fqdn = json['StaticHostname']; } catch (e) { try { - const stdout = execSync('hostname -f 2>/dev/null'); + const stdout = execSync('hostname -f 2>/dev/null', util.execOptsLinux); fqdn = stdout.toString().split(os.EOL)[0]; } catch (e) { util.noop(); diff --git a/lib/processes.js b/lib/processes.js index 96e48ec9..dacc7b3a 100644 --- a/lib/processes.js +++ b/lib/processes.js @@ -152,7 +152,7 @@ function services(srv, callback) { if (_linux || _freebsd || _openbsd || _netbsd || _darwin) { if ((_linux || _freebsd || _openbsd || _netbsd) && srvString === '*') { try { - const tmpsrv = execSync('systemctl --all --type=service --no-legend 2> /dev/null').toString().split('\n'); + const tmpsrv = execSync('systemctl --all --type=service --no-legend 2> /dev/null', util.execOptsLinux).toString().split('\n'); srvs = []; for (const s of tmpsrv) { const name = s.split('.service')[0]; @@ -164,7 +164,7 @@ function services(srv, callback) { } catch (d) { try { srvString = ''; - const tmpsrv = execSync('service --status-all 2> /dev/null').toString().split('\n'); + const tmpsrv = execSync('service --status-all 2> /dev/null', util.execOptsLinux).toString().split('\n'); for (const s of tmpsrv) { const parts = s.split(']'); if (parts.length === 2) { @@ -174,7 +174,7 @@ function services(srv, callback) { srvs = srvString.split('|'); } catch (e) { try { - const srvStr = execSync('ls /etc/init.d/ -m 2> /dev/null').toString().split('\n').join(''); + const srvStr = execSync('ls /etc/init.d/ -m 2> /dev/null', util.execOptsLinux).toString().split('\n').join(''); srvString = ''; if (srvStr) { const tmpsrv = srvStr.split(','); diff --git a/lib/system.js b/lib/system.js index 6448b053..06c41d3e 100644 --- a/lib/system.js +++ b/lib/system.js @@ -61,7 +61,7 @@ function system(callback) { echo -n "product_version: "; cat /sys/devices/virtual/dmi/id/product_version 2>/dev/null; echo; echo -n "sys_vendor: "; cat /sys/devices/virtual/dmi/id/sys_vendor 2>/dev/null; echo;`; try { - lines = execSync(cmd).toString().split('\n'); + lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); result.manufacturer = result.manufacturer === '' ? util.getValue(lines, 'sys_vendor') : result.manufacturer; result.model = result.model === '' ? util.getValue(lines, 'product_name') : result.model; result.version = result.version === '' ? util.getValue(lines, 'product_version') : result.version; @@ -107,7 +107,7 @@ function system(callback) { } if (!result.virtual) { try { - const disksById = execSync('ls -1 /dev/disk/by-id/ 2>/dev/null').toString(); + const disksById = execSync('ls -1 /dev/disk/by-id/ 2>/dev/null', util.execOptsLinux).toString(); if (disksById.indexOf('_QEMU_') >= 0) { result.virtual = true; result.virtualHost = 'QEMU'; @@ -129,7 +129,7 @@ function system(callback) { } if ((_freebsd || _openbsd || _netbsd) && !result.virtualHost) { try { - const procInfo = execSync('dmidecode -t 4'); + const procInfo = execSync('dmidecode -t 4', util.execOptsLinux); const procLines = procInfo.toString().split('\n'); const procManufacturer = util.getValue(procLines, 'manufacturer', ':', true); switch (procManufacturer.toLowerCase()) { @@ -371,7 +371,7 @@ function bios(callback) { echo -n "bios_vendor: "; cat /sys/devices/virtual/dmi/id/bios_vendor 2>/dev/null; echo; echo -n "bios_version: "; cat /sys/devices/virtual/dmi/id/bios_version 2>/dev/null; echo;`; try { - lines = execSync(cmd).toString().split('\n'); + lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); result.vendor = !result.vendor ? util.getValue(lines, 'bios_vendor') : result.vendor; result.version = !result.version ? util.getValue(lines, 'bios_version') : result.version; datetime = util.getValue(lines, 'bios_date'); @@ -485,7 +485,7 @@ function baseboard(callback) { echo -n "board_vendor: "; cat /sys/devices/virtual/dmi/id/board_vendor 2>/dev/null; echo; echo -n "board_version: "; cat /sys/devices/virtual/dmi/id/board_version 2>/dev/null; echo;`; try { - lines = execSync(cmd).toString().split('\n'); + lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); result.manufacturer = !result.manufacturer ? util.getValue(lines, 'board_vendor') : result.manufacturer; result.model = !result.model ? util.getValue(lines, 'board_name') : result.model; result.version = !result.version ? util.getValue(lines, 'board_version') : result.version; diff --git a/lib/util.js b/lib/util.js index f5c1a5df..3c59d0de 100644 --- a/lib/util.js +++ b/lib/util.js @@ -55,6 +55,12 @@ const execOptsWin = { env: Object.assign({}, process.env, { LANG: 'en_US.UTF-8' }) }; +const execOptsLinux = { + maxBuffer: 1024 * 20000, + encoding: 'UTF-8', + stdio: ['pipe', 'pipe', 'ignore'] +}; + function toInt(value) { let result = parseInt(value, 10); if (isNaN(result)) { @@ -573,7 +579,7 @@ function getCodepage() { if (_linux || _darwin || _freebsd || _openbsd || _netbsd) { if (!codepage) { try { - const stdout = execSync('echo $LANG'); + const stdout = execSync('echo $LANG', util.execOptsLinux); const lines = stdout.toString().split('\r\n'); const parts = lines[0].split('.'); codepage = parts.length > 1 ? parts[1].trim() : ''; @@ -607,7 +613,7 @@ function smartMonToolsInstalled() { } if (_linux || _darwin || _freebsd || _openbsd || _netbsd) { try { - const pathArray = execSync('which smartctl 2>/dev/null', execOptsWin).toString().split('\r\n'); + const pathArray = execSync('which smartctl 2>/dev/null', execOptsLinux).toString().split('\r\n'); _smartMonToolsInstalled = pathArray.length > 0; } catch (e) { util.noop(); @@ -1146,7 +1152,7 @@ function linuxVersion() { let result = ''; if (_linux) { try { - result = execSync('uname -v').toString(); + result = execSync('uname -v', util.execOptsLinux).toString(); } catch (e) { result = ''; } @@ -1318,6 +1324,7 @@ function noop() { } exports.toInt = toInt; exports.splitByNumber = splitByNumber; exports.execOptsWin = execOptsWin; +exports.execOptsLinux = execOptsLinux; exports.getCodepage = getCodepage; exports.execWin = execWin; exports.isFunction = isFunction; diff --git a/lib/wifi.js b/lib/wifi.js index 30fc6453..40764f79 100644 --- a/lib/wifi.js +++ b/lib/wifi.js @@ -130,7 +130,7 @@ function ifaceListLinux() { const result = []; const cmd = 'iw dev 2>/dev/null'; try { - const all = execSync(cmd).toString().split('\n').map(line => line.trim()).join('\n'); + const all = execSync(cmd, util.execOptsLinux).toString().split('\n').map(line => line.trim()).join('\n'); const parts = all.split('\nInterface '); parts.shift(); parts.forEach(ifaceDetails => { @@ -149,7 +149,7 @@ function ifaceListLinux() { return result; } catch (e) { try { - const all = execSync('nmcli -t -f general,wifi-properties,wired-properties,interface-flags,capabilities,nsp device show 2>/dev/null').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'); let i = 1; parts.forEach(ifaceDetails => { @@ -178,7 +178,7 @@ function ifaceListLinux() { function nmiDeviceLinux(iface) { const cmd = `nmcli -t -f general,wifi-properties,capabilities,ip4,ip6 device show ${iface} 2>/dev/null`; try { - const lines = execSync(cmd).toString().split('\n'); + const lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); const ssid = util.getValue(lines, 'GENERAL.CONNECTION'); return { iface, @@ -196,7 +196,7 @@ function nmiDeviceLinux(iface) { function nmiConnectionLinux(ssid) { const cmd = `nmcli -t --show-secrets connection show ${ssid} 2>/dev/null`; try { - const lines = execSync(cmd).toString().split('\n'); + const lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); const bssid = util.getValue(lines, '802-11-wireless.seen-bssids').toLowerCase(); return { ssid: ssid !== '--' ? ssid : null, @@ -217,7 +217,7 @@ function wpaConnectionLinux(iface) { } const cmd = `wpa_cli -i ${iface} status 2>&1`; try { - const lines = execSync(cmd).toString().split('\n'); + const lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); const freq = util.toInt(util.getValue(lines, 'freq', '=')); return { ssid: util.getValue(lines, 'ssid', '='), @@ -236,7 +236,7 @@ function getWifiNetworkListNmi() { const result = []; const cmd = 'nmcli -t -m multiline --fields active,ssid,bssid,mode,chan,freq,signal,security,wpa-flags,rsn-flags device wifi list 2>/dev/null'; try { - const stdout = execSync(cmd, { maxBuffer: 1024 * 20000 }); + const stdout = execSync(cmd, util.execOptsLinux); const parts = stdout.toString().split('ACTIVE:'); parts.shift(); parts.forEach(part => { @@ -270,7 +270,7 @@ function getWifiNetworkListNmi() { function getWifiNetworkListIw(iface) { const result = []; try { - let iwlistParts = execSync(`export LC_ALL=C; iwlist ${iface} scan 2>&1; unset LC_ALL`).toString().split(' Cell '); + let iwlistParts = execSync(`export LC_ALL=C; iwlist ${iface} scan 2>&1; unset LC_ALL`, util.execOptsLinux).toString().split(' Cell '); if (iwlistParts[0].indexOf('resource busy') >= 0) { return -1; } if (iwlistParts.length > 1) { iwlistParts.shift(); @@ -404,7 +404,7 @@ function wifiNetworks(callback) { result = getWifiNetworkListNmi(); if (result.length === 0) { try { - const iwconfigParts = execSync('export LC_ALL=C; iwconfig 2>/dev/null; unset LC_ALL').toString().split('\n\n'); + const iwconfigParts = execSync('export LC_ALL=C; iwconfig 2>/dev/null; unset LC_ALL', util.execOptsLinux).toString().split('\n\n'); let iface = ''; iwconfigParts.forEach(element => { if (element.indexOf('no wireless') === -1 && element.trim() !== '') {