systeminformation 5.11.20 → 5.11.21

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
@@ -49,12 +49,17 @@ function fsSize(callback) {
49
49
  return 'HFS';
50
50
  }
51
51
 
52
+ function isLinuxTmpFs(fs) {
53
+ const linuxTmpFileSystems = ['rootfs', 'unionfs', 'squashfs', 'cramfs', 'initrd', 'initramfs', 'devtmpfs', 'tmpfs', 'udev', 'devfs', 'specfs', 'type'];
54
+ return (linuxTmpFileSystems.includes(fs.toLowerCase()));
55
+ }
56
+
52
57
  function parseDf(lines) {
53
58
  let data = [];
54
59
  lines.forEach(function (line) {
55
60
  if (line !== '') {
56
61
  line = line.replace(/ +/g, ' ').split(' ');
57
- if (line && ((line[0].startsWith('/')) || (line[6] && line[6] === '/') || (line[0].indexOf('/') > 0) || (line[0].indexOf(':') === 1))) {
62
+ if (line && ((line[0].startsWith('/')) || (line[6] && line[6] === '/') || (line[0].indexOf('/') > 0) || (line[0].indexOf(':') === 1) || !_darwin && !isLinuxTmpFs(line[1]))) {
58
63
  const fs = line[0];
59
64
  const fsType = ((_linux || _freebsd || _openbsd || _netbsd) ? line[1] : getmacOsFsType(line[0]));
60
65
  const size = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[2] : line[1])) * 1024;
@@ -96,11 +101,12 @@ function fsSize(callback) {
96
101
  macOsDisks = [];
97
102
  }
98
103
  }
99
- if (_linux) { cmd = 'df -lkPTx squashfs | grep -E "^/|^.\\:"'; }
104
+ if (_linux) { cmd = 'df -lkPTx squashfs'; } // cmd = 'df -lkPTx squashfs | grep -E "^/|^.\\:"';
100
105
  if (_freebsd || _openbsd || _netbsd) { cmd = 'df -lkPT'; }
101
106
  exec(cmd, { maxBuffer: 1024 * 1024 }, function (error, stdout) {
102
107
  if (!error) {
103
108
  let lines = stdout.toString().split('\n');
109
+ if (lines && lines[0] && lines[0].toLowerCase().startsWith('filesystem')) { lines.shift(); }
104
110
  data = parseDf(lines);
105
111
  if (callback) {
106
112
  callback(data);
@@ -110,6 +116,7 @@ function fsSize(callback) {
110
116
  exec('df -kPT', { maxBuffer: 1024 * 1024 }, function (error, stdout) {
111
117
  if (!error) {
112
118
  let lines = stdout.toString().split('\n');
119
+ if (lines && lines[0] && lines[0].toLowerCase().startsWith('filesystem')) { lines.shift(); }
113
120
  data = parseDf(lines);
114
121
  }
115
122
  if (callback) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.11.20",
3
+ "version": "5.11.21",
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)",