systeminformation
Advanced tools
Comparing version
@@ -1056,3 +1056,3 @@ 'use strict'; | ||
ifaces[dev].forEach(function (details) { | ||
if (details?.mac && details.mac !== '00:00:00:00:00:00') { | ||
if (details && details.mac && details.mac !== '00:00:00:00:00:00') { | ||
const mac = details.mac.toLowerCase(); | ||
@@ -1059,0 +1059,0 @@ if (macs.indexOf(mac) === -1) { |
@@ -128,7 +128,22 @@ 'use strict'; | ||
} | ||
lines[i] = lines[i].replace(':Yes,', ':"Yes",'); | ||
lines[i] = lines[i].replace(': Yes,', ': "Yes",'); | ||
lines[i] = lines[i].replace(': Yes', ': "Yes"'); | ||
lines[i] = lines[i].replace(':No,', ':"No",'); | ||
lines[i] = lines[i].replace(': No,', ': "No",'); | ||
lines[i] = lines[i].replace(': No', ': "No"'); | ||
// In this case (("com.apple.developer.driverkit.transport.usb")) | ||
lines[i] = lines[i].replace('((', '').replace('))', ''); | ||
// In case we have <923c11> we need make it "<923c11>" for correct JSON parse | ||
const match = /<(\w+)>/.exec(lines[i]); | ||
if (match) { | ||
const number = match[0]; | ||
lines[i] = lines[i].replace(number, `"${number}"`); | ||
} | ||
} | ||
const usbObj = JSON.parse(lines.join('\n')); | ||
const removableDrive = usbObj['Built-In'].toLowerCase() !== 'yes' && usbObj['non-removable'].toLowerCase() === 'no'; | ||
const removableDrive = (usbObj['Built-In'] ? usbObj['Built-In'].toLowerCase() !== 'yes' : true) && (usbObj['non-removable'] ? usbObj['non-removable'].toLowerCase() === 'no' : true); | ||
@@ -140,5 +155,6 @@ result.bus = null; | ||
result.type = getDarwinUsbType((usbObj['kUSBProductString'] || usbObj['USB Product Name'] || '').toLowerCase() + (removableDrive ? ' removable' : '')); | ||
result.removable = usbObj['non-removable'].toLowerCase() === 'no'; | ||
result.removable = usbObj['non-removable'] ? usbObj['non-removable'].toLowerCase() || '' === 'no' : true; | ||
result.vendor = usbObj['kUSBVendorString'] || usbObj['USB Vendor Name'] || null; | ||
result.manufacturer = usbObj['kUSBVendorString'] || usbObj['USB Vendor Name'] || null; | ||
result.maxPower = null; | ||
@@ -145,0 +161,0 @@ result.serialNumber = usbObj['kUSBSerialNumberString'] || null; |
@@ -318,3 +318,3 @@ 'use strict'; | ||
const wmicPathArray = execSync('WHERE WMIC', execOptsWin).toString().split('\r\n'); | ||
if (wmicPathArray?.length) { | ||
if (wmicPathArray && wmicPathArray.length) { | ||
wmicPath = wmicPathArray[0]; | ||
@@ -389,3 +389,3 @@ } else { | ||
}); | ||
if (_psChild?.pid) { | ||
if (_psChild && _psChild.pid) { | ||
_psPersistent = true; | ||
@@ -441,3 +441,3 @@ _psChild.stdout.on('data', function (data) { | ||
try { | ||
if (_psChild?.pid) { | ||
if (_psChild && _psChild.pid) { | ||
_psChild.stdin.write(_psToUTF8 + 'echo ' + _psCmdStart + id + _psIdSeperator + '; ' + os.EOL + cmd + os.EOL + 'echo ' + _psCmdSeperator + os.EOL); | ||
@@ -470,3 +470,3 @@ } | ||
} | ||
if (child?.pid) { | ||
if (child && child.pid) { | ||
child.stdout.on('data', function (data) { | ||
@@ -521,3 +521,3 @@ result = result + data.toString('utf8'); | ||
} | ||
if (child?.pid) { | ||
if (child && child.pid) { | ||
child.stdout.on('data', function (data) { | ||
@@ -584,3 +584,3 @@ result += data.toString(); | ||
const pathArray = execSync('WHERE smartctl 2>nul', execOptsWin).toString().split('\r\n'); | ||
if (pathArray?.length) { | ||
if (pathArray && pathArray.length) { | ||
_smartMonToolsInstalled = pathArray[0].indexOf(':\\') >= 0; | ||
@@ -587,0 +587,0 @@ } else { |
{ | ||
"name": "systeminformation", | ||
"version": "5.17.15", | ||
"version": "5.17.16", | ||
"description": "Advanced, lightweight system and OS information library", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
726986
0.11%15359
0.08%