systeminformation 5.17.15 → 5.17.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/osinfo.js CHANGED
@@ -1053,7 +1053,7 @@ function getUniqueMacAdresses() {
1053
1053
  for (let dev in ifaces) {
1054
1054
  if ({}.hasOwnProperty.call(ifaces, dev)) {
1055
1055
  ifaces[dev].forEach(function (details) {
1056
- if (details?.mac && details.mac !== '00:00:00:00:00:00') {
1056
+ if (details && details.mac && details.mac !== '00:00:00:00:00:00') {
1057
1057
  const mac = details.mac.toLowerCase();
1058
1058
  if (macs.indexOf(mac) === -1) {
1059
1059
  macs.push(mac);
package/lib/usb.js CHANGED
@@ -125,20 +125,36 @@ function parseDarwinUsb(usb, id) {
125
125
  if (lines[i] !== '{' && lines[i] !== '}' && lines[i + 1] && lines[i + 1].trim() !== '}') {
126
126
  lines[i] = lines[i] + ',';
127
127
  }
128
+
129
+ lines[i] = lines[i].replace(':Yes,', ':"Yes",');
128
130
  lines[i] = lines[i].replace(': Yes,', ': "Yes",');
131
+ lines[i] = lines[i].replace(': Yes', ': "Yes"');
132
+ lines[i] = lines[i].replace(':No,', ':"No",');
129
133
  lines[i] = lines[i].replace(': No,', ': "No",');
134
+ lines[i] = lines[i].replace(': No', ': "No"');
135
+
136
+ // In this case (("com.apple.developer.driverkit.transport.usb"))
137
+ lines[i] = lines[i].replace('((', '').replace('))', '');
138
+
139
+ // In case we have <923c11> we need make it "<923c11>" for correct JSON parse
140
+ const match = /<(\w+)>/.exec(lines[i]);
141
+ if (match) {
142
+ const number = match[0];
143
+ lines[i] = lines[i].replace(number, `"${number}"`);
144
+ }
130
145
  }
131
146
  const usbObj = JSON.parse(lines.join('\n'));
132
- const removableDrive = usbObj['Built-In'].toLowerCase() !== 'yes' && usbObj['non-removable'].toLowerCase() === 'no';
147
+ const removableDrive = (usbObj['Built-In'] ? usbObj['Built-In'].toLowerCase() !== 'yes' : true) && (usbObj['non-removable'] ? usbObj['non-removable'].toLowerCase() === 'no' : true);
133
148
 
134
149
  result.bus = null;
135
150
  result.deviceId = null;
136
151
  result.id = usbObj['USB Address'] || null;
137
152
  result.name = usbObj['kUSBProductString'] || usbObj['USB Product Name'] || null;
138
153
  result.type = getDarwinUsbType((usbObj['kUSBProductString'] || usbObj['USB Product Name'] || '').toLowerCase() + (removableDrive ? ' removable' : ''));
139
- result.removable = usbObj['non-removable'].toLowerCase() === 'no';
154
+ result.removable = usbObj['non-removable'] ? usbObj['non-removable'].toLowerCase() || '' === 'no' : true;
140
155
  result.vendor = usbObj['kUSBVendorString'] || usbObj['USB Vendor Name'] || null;
141
156
  result.manufacturer = usbObj['kUSBVendorString'] || usbObj['USB Vendor Name'] || null;
157
+
142
158
  result.maxPower = null;
143
159
  result.serialNumber = usbObj['kUSBSerialNumberString'] || null;
144
160
 
package/lib/util.js CHANGED
@@ -315,7 +315,7 @@ function getWmic() {
315
315
  if (!fs.existsSync(wmicPath)) {
316
316
  try {
317
317
  const wmicPathArray = execSync('WHERE WMIC', execOptsWin).toString().split('\r\n');
318
- if (wmicPathArray?.length) {
318
+ if (wmicPathArray && wmicPathArray.length) {
319
319
  wmicPath = wmicPathArray[0];
320
320
  } else {
321
321
  wmicPath = 'wmic';
@@ -385,7 +385,7 @@ function powerShellStart() {
385
385
  encoding: 'UTF-8',
386
386
  env: util._extend({}, process.env, { LANG: 'en_US.UTF-8' })
387
387
  });
388
- if (_psChild?.pid) {
388
+ if (_psChild && _psChild.pid) {
389
389
  _psPersistent = true;
390
390
  _psChild.stdout.on('data', function (data) {
391
391
  _psResult = _psResult + data.toString('utf8');
@@ -436,7 +436,7 @@ function powerShell(cmd) {
436
436
  start: new Date()
437
437
  });
438
438
  try {
439
- if (_psChild?.pid) {
439
+ if (_psChild && _psChild.pid) {
440
440
  _psChild.stdin.write(_psToUTF8 + 'echo ' + _psCmdStart + id + _psIdSeperator + '; ' + os.EOL + cmd + os.EOL + 'echo ' + _psCmdSeperator + os.EOL);
441
441
  }
442
442
  } catch (e) {
@@ -464,7 +464,7 @@ function powerShell(cmd) {
464
464
  resolve(result);
465
465
  });
466
466
  }
467
- if (child?.pid) {
467
+ if (child && child.pid) {
468
468
  child.stdout.on('data', function (data) {
469
469
  result = result + data.toString('utf8');
470
470
  });
@@ -514,7 +514,7 @@ function execSafe(cmd, args, options) {
514
514
  resolve(result);
515
515
  });
516
516
  }
517
- if (child?.pid) {
517
+ if (child && child.pid) {
518
518
  child.stdout.on('data', function (data) {
519
519
  result += data.toString();
520
520
  });
@@ -576,7 +576,7 @@ function smartMonToolsInstalled() {
576
576
  if (_windows) {
577
577
  try {
578
578
  const pathArray = execSync('WHERE smartctl 2>nul', execOptsWin).toString().split('\r\n');
579
- if (pathArray?.length) {
579
+ if (pathArray && pathArray.length) {
580
580
  _smartMonToolsInstalled = pathArray[0].indexOf(':\\') >= 0;
581
581
  } else {
582
582
  _smartMonToolsInstalled = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.17.15",
3
+ "version": "5.17.16",
4
4
  "description": "Advanced, lightweight system and OS information library",
5
5
  "license": "MIT",
6
6
  "author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",