systeminformation 5.18.5 → 5.18.7

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/filesystem.js CHANGED
@@ -137,18 +137,26 @@ function fsSize(drive, callback) {
137
137
  }
138
138
  }
139
139
  if (_linux) {
140
- cmd = 'export LC_ALL=C; df -lkPTx squashfs; unset LC_ALL';
141
- execSync('cat /proc/mounts 2>/dev/null').toString().split('\n').filter(line => {
142
- return line.startsWith('/');
143
- }).forEach((line) => {
144
- osMounts[line.split(' ')[0]] = line.toLowerCase().indexOf('rw') >= 0;
145
- });
140
+ try {
141
+ cmd = 'export LC_ALL=C; df -lkPTx squashfs; unset LC_ALL';
142
+ execSync('cat /proc/mounts 2>/dev/null').toString().split('\n').filter(line => {
143
+ return line.startsWith('/');
144
+ }).forEach((line) => {
145
+ osMounts[line.split(' ')[0]] = line.toLowerCase().indexOf('rw') >= 0;
146
+ });
147
+ } catch (e) {
148
+ util.noop();
149
+ }
146
150
  }
147
151
  if (_freebsd || _openbsd || _netbsd) {
148
- cmd = 'df -lkPT';
149
- execSync('mount').toString().split('\n').forEach((line) => {
150
- osMounts[line.split(' ')[0]] = line.toLowerCase().indexOf('read-only') === -1;
151
- });
152
+ try {
153
+ cmd = 'df -lkPT';
154
+ execSync('mount').toString().split('\n').forEach((line) => {
155
+ osMounts[line.split(' ')[0]] = line.toLowerCase().indexOf('read-only') === -1;
156
+ });
157
+ } catch (e) {
158
+ util.noop();
159
+ }
152
160
  }
153
161
  exec(cmd, { maxBuffer: 1024 * 1024 }, function (error, stdout) {
154
162
  let lines = filterLines(stdout);
@@ -1075,10 +1083,14 @@ function diskLayout(callback) {
1075
1083
  }
1076
1084
  } catch (e) {
1077
1085
  // fallback to older version of lsblk
1078
- 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();
1079
- let lines = blkStdoutToObject(out2).split('\n');
1080
- const data = parseBlk(lines);
1081
- devices = data.filter(item => { return (item.type === 'disk') && item.size > 0 && ((item.model !== null && item.model !== '') || (item.mount === '' && item.label === '' && item.fsType === '')); });
1086
+ try {
1087
+ 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();
1088
+ let lines = blkStdoutToObject(out2).split('\n');
1089
+ const data = parseBlk(lines);
1090
+ devices = data.filter(item => { return (item.type === 'disk') && item.size > 0 && ((item.model !== null && item.model !== '') || (item.mount === '' && item.label === '' && item.fsType === '')); });
1091
+ } catch (e) {
1092
+ util.noop();
1093
+ }
1082
1094
  }
1083
1095
  devices.forEach((device) => {
1084
1096
  let mediumType = '';
package/lib/graphics.js CHANGED
@@ -669,39 +669,42 @@ function graphics(callback) {
669
669
  } catch (e) {
670
670
  util.noop();
671
671
  }
672
- stdout = execSync('defaults read /Library/Preferences/com.apple.windowserver.plist 2>/dev/null;defaults read /Library/Preferences/com.apple.windowserver.displays.plist 2>/dev/null; echo ""', { maxBuffer: 1024 * 20000 });
673
- const output = (stdout || '').toString();
674
- const obj = util.plistReader(output);
675
- if (obj['DisplayAnyUserSets'] && obj['DisplayAnyUserSets']['Configs'] && obj['DisplayAnyUserSets']['Configs'][0] && obj['DisplayAnyUserSets']['Configs'][0]['DisplayConfig']) {
676
- const current = obj['DisplayAnyUserSets']['Configs'][0]['DisplayConfig'];
677
- let i = 0;
678
- current.forEach((o) => {
679
- if (o['CurrentInfo'] && o['CurrentInfo']['OriginX'] !== undefined && result.displays && result.displays[i]) {
680
- result.displays[i].positionX = o['CurrentInfo']['OriginX'];
681
- }
682
- if (o['CurrentInfo'] && o['CurrentInfo']['OriginY'] !== undefined && result.displays && result.displays[i]) {
683
- result.displays[i].positionY = o['CurrentInfo']['OriginY'];
684
- }
685
- i++;
686
- });
687
- }
688
- if (obj['DisplayAnyUserSets'] && obj['DisplayAnyUserSets'].length > 0 && obj['DisplayAnyUserSets'][0].length > 0 && obj['DisplayAnyUserSets'][0][0]['DisplayID']) {
689
- const current = obj['DisplayAnyUserSets'][0];
690
- let i = 0;
691
- current.forEach((o) => {
692
- if ('OriginX' in o && result.displays && result.displays[i]) {
693
- result.displays[i].positionX = o['OriginX'];
694
- }
695
- if ('OriginY' in o && result.displays && result.displays[i]) {
696
- result.displays[i].positionY = o['OriginY'];
697
- }
698
- if (o['Mode'] && o['Mode']['BitsPerPixel'] !== undefined && result.displays && result.displays[i]) {
699
- result.displays[i].pixelDepth = o['Mode']['BitsPerPixel'];
700
- }
701
- i++;
702
- });
672
+ try {
673
+ stdout = execSync('defaults read /Library/Preferences/com.apple.windowserver.plist 2>/dev/null;defaults read /Library/Preferences/com.apple.windowserver.displays.plist 2>/dev/null; echo ""', { maxBuffer: 1024 * 20000 });
674
+ const output = (stdout || '').toString();
675
+ const obj = util.plistReader(output);
676
+ if (obj['DisplayAnyUserSets'] && obj['DisplayAnyUserSets']['Configs'] && obj['DisplayAnyUserSets']['Configs'][0] && obj['DisplayAnyUserSets']['Configs'][0]['DisplayConfig']) {
677
+ const current = obj['DisplayAnyUserSets']['Configs'][0]['DisplayConfig'];
678
+ let i = 0;
679
+ current.forEach((o) => {
680
+ if (o['CurrentInfo'] && o['CurrentInfo']['OriginX'] !== undefined && result.displays && result.displays[i]) {
681
+ result.displays[i].positionX = o['CurrentInfo']['OriginX'];
682
+ }
683
+ if (o['CurrentInfo'] && o['CurrentInfo']['OriginY'] !== undefined && result.displays && result.displays[i]) {
684
+ result.displays[i].positionY = o['CurrentInfo']['OriginY'];
685
+ }
686
+ i++;
687
+ });
688
+ }
689
+ if (obj['DisplayAnyUserSets'] && obj['DisplayAnyUserSets'].length > 0 && obj['DisplayAnyUserSets'][0].length > 0 && obj['DisplayAnyUserSets'][0][0]['DisplayID']) {
690
+ const current = obj['DisplayAnyUserSets'][0];
691
+ let i = 0;
692
+ current.forEach((o) => {
693
+ if ('OriginX' in o && result.displays && result.displays[i]) {
694
+ result.displays[i].positionX = o['OriginX'];
695
+ }
696
+ if ('OriginY' in o && result.displays && result.displays[i]) {
697
+ result.displays[i].positionY = o['OriginY'];
698
+ }
699
+ if (o['Mode'] && o['Mode']['BitsPerPixel'] !== undefined && result.displays && result.displays[i]) {
700
+ result.displays[i].pixelDepth = o['Mode']['BitsPerPixel'];
701
+ }
702
+ i++;
703
+ });
704
+ }
705
+ } catch (e) {
706
+ util.noop();
703
707
  }
704
-
705
708
  }
706
709
  if (callback) {
707
710
  callback(result);
package/lib/index.d.ts CHANGED
@@ -2,6 +2,8 @@
2
2
  // Project: https://github.com/sebhildebrandt/systeminformation
3
3
  // Definitions by: sebhildebrandt <https://github.com/sebhildebrandt>
4
4
 
5
+ /// <reference types="node" />
6
+
5
7
  export namespace Systeminformation {
6
8
 
7
9
  // 1. General
package/lib/osinfo.js CHANGED
@@ -314,6 +314,7 @@ function osInfo(callback) {
314
314
  result.codename = (result.release.startsWith('11.') ? 'macOS Big Sur' : result.codename);
315
315
  result.codename = (result.release.startsWith('12.') ? 'macOS Monterey' : result.codename);
316
316
  result.codename = (result.release.startsWith('13.') ? 'macOS Ventura' : result.codename);
317
+ result.codename = (result.release.startsWith('14.') ? 'macOS Sonoma' : result.codename);
317
318
  result.uefi = true;
318
319
  result.codepage = util.getCodepage();
319
320
  if (callback) {
@@ -788,23 +789,28 @@ function versions(apps, callback) {
788
789
  }
789
790
  if ({}.hasOwnProperty.call(appsObj.versions, 'python')) {
790
791
  if (_darwin) {
791
- const stdout = execSync('sw_vers');
792
- const lines = stdout.toString().split('\n');
793
- const osVersion = util.getValue(lines, 'ProductVersion', ':');
794
- const gitHomebrewExists1 = fs.existsSync('/usr/local/Cellar/python');
795
- const gitHomebrewExists2 = fs.existsSync('/opt/homebrew/bin/python');
796
- if ((util.darwinXcodeExists() && util.semverCompare('12.0.1', osVersion) < 0) || gitHomebrewExists1 || gitHomebrewExists2) {
797
- const cmd = gitHomebrewExists1 ? '/usr/local/Cellar/python -V 2>&1' : (gitHomebrewExists2 ? '/opt/homebrew/bin/python -V 2>&1' : 'python -V 2>&1');
798
- exec(cmd, function (error, stdout) {
799
- if (!error) {
800
- const python = stdout.toString().split('\n')[0] || '';
801
- appsObj.versions.python = python.toLowerCase().replace('python', '').trim();
802
- }
792
+ try {
793
+ const stdout = execSync('sw_vers');
794
+ const lines = stdout.toString().split('\n');
795
+ const osVersion = util.getValue(lines, 'ProductVersion', ':');
796
+ const gitHomebrewExists1 = fs.existsSync('/usr/local/Cellar/python');
797
+ const gitHomebrewExists2 = fs.existsSync('/opt/homebrew/bin/python');
798
+ if ((util.darwinXcodeExists() && util.semverCompare('12.0.1', osVersion) < 0) || gitHomebrewExists1 || gitHomebrewExists2) {
799
+ const cmd = gitHomebrewExists1 ? '/usr/local/Cellar/python -V 2>&1' : (gitHomebrewExists2 ? '/opt/homebrew/bin/python -V 2>&1' : 'python -V 2>&1');
800
+ exec(cmd, function (error, stdout) {
801
+ if (!error) {
802
+ const python = stdout.toString().split('\n')[0] || '';
803
+ appsObj.versions.python = python.toLowerCase().replace('python', '').trim();
804
+ }
805
+ functionProcessed();
806
+ });
807
+ } else {
803
808
  functionProcessed();
804
- });
805
- } else {
809
+ }
810
+ } catch (e) {
806
811
  functionProcessed();
807
812
  }
813
+
808
814
  } else {
809
815
  exec('python -V 2>&1', function (error, stdout) {
810
816
  if (!error) {
package/lib/util.js CHANGED
@@ -586,8 +586,12 @@ function smartMonToolsInstalled() {
586
586
  }
587
587
  }
588
588
  if (_linux || _darwin || _freebsd || _openbsd || _netbsd) {
589
- const pathArray = execSync('which smartctl 2>/dev/null', execOptsWin).toString().split('\r\n');
590
- _smartMonToolsInstalled = pathArray.length > 0;
589
+ try {
590
+ const pathArray = execSync('which smartctl 2>/dev/null', execOptsWin).toString().split('\r\n');
591
+ _smartMonToolsInstalled = pathArray.length > 0;
592
+ } catch (e) {
593
+ util.noop();
594
+ }
591
595
  }
592
596
  return _smartMonToolsInstalled;
593
597
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.18.5",
3
+ "version": "5.18.7",
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)",