systeminformation 5.17.13 → 5.17.15

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
@@ -289,7 +289,7 @@ function osInfo(callback) {
289
289
  let lines = stdout.toString().split('\n');
290
290
  result.serial = util.getValue(lines, 'kern.uuid');
291
291
  result.distro = util.getValue(lines, 'ProductName');
292
- result.release = util.getValue(lines, 'ProductVersion');
292
+ result.release = (util.getValue(lines, 'ProductVersion', ':', true, true) + ' ' + util.getValue(lines, 'ProductVersionExtra', ':', true, true)).trim();
293
293
  result.build = util.getValue(lines, 'BuildVersion');
294
294
  result.logofile = getLogoFile(result.distro);
295
295
  result.codename = 'macOS';
@@ -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 && details.mac && details.mac !== '00:00:00:00:00:00') {
1056
+ if (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/util.js CHANGED
@@ -119,7 +119,7 @@ function getValue(lines, property, separator, trimmed, lineMatch) {
119
119
  trimmed = trimmed || false;
120
120
  lineMatch = lineMatch || false;
121
121
  let result = '';
122
- lines.forEach((line) => {
122
+ lines.some((line) => {
123
123
  let lineLower = line.toLowerCase().replace(/\t/g, '');
124
124
  if (trimmed) {
125
125
  lineLower = lineLower.trim();
@@ -129,6 +129,7 @@ function getValue(lines, property, separator, trimmed, lineMatch) {
129
129
  if (parts.length >= 2) {
130
130
  parts.shift();
131
131
  result = parts.join(separator).trim();
132
+ return true;
132
133
  }
133
134
  }
134
135
  });
@@ -314,7 +315,7 @@ function getWmic() {
314
315
  if (!fs.existsSync(wmicPath)) {
315
316
  try {
316
317
  const wmicPathArray = execSync('WHERE WMIC', execOptsWin).toString().split('\r\n');
317
- if (wmicPathArray && wmicPathArray.length) {
318
+ if (wmicPathArray?.length) {
318
319
  wmicPath = wmicPathArray[0];
319
320
  } else {
320
321
  wmicPath = 'wmic';
@@ -377,14 +378,14 @@ function powerShellProceedResults(data) {
377
378
 
378
379
  function powerShellStart() {
379
380
  if (!_psChild) {
380
- _psChild = spawn('powershell.exe', ['-NoLogo', '-InputFormat', 'Text', '-NoExit', '-Command', '-'], {
381
+ _psChild = spawn('powershell.exe', ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-NoExit', '-Command', '-'], {
381
382
  stdio: 'pipe',
382
383
  windowsHide: true,
383
384
  maxBuffer: 1024 * 20000,
384
385
  encoding: 'UTF-8',
385
386
  env: util._extend({}, process.env, { LANG: 'en_US.UTF-8' })
386
387
  });
387
- if (_psChild && _psChild.pid) {
388
+ if (_psChild?.pid) {
388
389
  _psPersistent = true;
389
390
  _psChild.stdout.on('data', function (data) {
390
391
  _psResult = _psResult + data.toString('utf8');
@@ -435,7 +436,7 @@ function powerShell(cmd) {
435
436
  start: new Date()
436
437
  });
437
438
  try {
438
- if (_psChild && _psChild.pid) {
439
+ if (_psChild?.pid) {
439
440
  _psChild.stdin.write(_psToUTF8 + 'echo ' + _psCmdStart + id + _psIdSeperator + '; ' + os.EOL + cmd + os.EOL + 'echo ' + _psCmdSeperator + os.EOL);
440
441
  }
441
442
  } catch (e) {
@@ -450,7 +451,7 @@ function powerShell(cmd) {
450
451
  return new Promise((resolve) => {
451
452
  process.nextTick(() => {
452
453
  try {
453
- const child = spawn('powershell.exe', ['-NoLogo', '-InputFormat', 'Text', '-NoExit', '-ExecutionPolicy', 'Unrestricted', '-Command', '-'], {
454
+ const child = spawn('powershell.exe', ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-NoExit', '-ExecutionPolicy', 'Unrestricted', '-Command', '-'], {
454
455
  stdio: 'pipe',
455
456
  windowsHide: true,
456
457
  maxBuffer: 1024 * 20000,
@@ -463,7 +464,7 @@ function powerShell(cmd) {
463
464
  resolve(result);
464
465
  });
465
466
  }
466
- if (child && child.pid) {
467
+ if (child?.pid) {
467
468
  child.stdout.on('data', function (data) {
468
469
  result = result + data.toString('utf8');
469
470
  });
@@ -513,7 +514,7 @@ function execSafe(cmd, args, options) {
513
514
  resolve(result);
514
515
  });
515
516
  }
516
- if (child && child.pid) {
517
+ if (child?.pid) {
517
518
  child.stdout.on('data', function (data) {
518
519
  result += data.toString();
519
520
  });
@@ -575,7 +576,7 @@ function smartMonToolsInstalled() {
575
576
  if (_windows) {
576
577
  try {
577
578
  const pathArray = execSync('WHERE smartctl 2>nul', execOptsWin).toString().split('\r\n');
578
- if (pathArray && pathArray.length) {
579
+ if (pathArray?.length) {
579
580
  _smartMonToolsInstalled = pathArray[0].indexOf(':\\') >= 0;
580
581
  } else {
581
582
  _smartMonToolsInstalled = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.17.13",
3
+ "version": "5.17.15",
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)",