systeminformation 5.13.0 → 5.13.1

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.
Files changed (2) hide show
  1. package/lib/processes.js +9 -5
  2. package/package.json +1 -1
package/lib/processes.js CHANGED
@@ -1122,7 +1122,7 @@ function processLoad(proc, callback) {
1122
1122
  }
1123
1123
 
1124
1124
  if (_darwin || _linux || _freebsd || _openbsd || _netbsd) {
1125
- const params = ['-axo', 'pid,pcpu,pmem,comm'];
1125
+ const params = ['-axo', 'pid,ppid,pcpu,pmem,comm'];
1126
1126
  util.execSafe('ps', params).then((stdout) => {
1127
1127
  if (stdout) {
1128
1128
  let procStats = [];
@@ -1138,12 +1138,13 @@ function processLoad(proc, callback) {
1138
1138
 
1139
1139
  lines.forEach(function (line) {
1140
1140
  let data = line.trim().replace(/ +/g, ' ').split(' ');
1141
- if (data.length > 3) {
1141
+ if (data.length > 4) {
1142
1142
  procStats.push({
1143
- name: data[3].substring(data[3].lastIndexOf('/') + 1),
1143
+ name: data[4].substring(data[4].lastIndexOf('/') + 1),
1144
1144
  pid: parseInt(data[0]) || 0,
1145
- cpu: parseFloat(data[1].replace(',', '.')),
1146
- mem: parseFloat(data[2].replace(',', '.'))
1145
+ ppid: parseInt(data[1]) || 0,
1146
+ cpu: parseFloat(data[2].replace(',', '.')),
1147
+ mem: parseFloat(data[3].replace(',', '.'))
1147
1148
  });
1148
1149
  }
1149
1150
  });
@@ -1174,6 +1175,9 @@ function processLoad(proc, callback) {
1174
1175
  mem: item.mem
1175
1176
  });
1176
1177
  } else {
1178
+ if (item.ppid < 10) {
1179
+ result[listPos].pid = item.pid;
1180
+ }
1177
1181
  result[listPos].pids.push(item.pid);
1178
1182
  result[listPos].cpu += item.cpu;
1179
1183
  result[listPos].mem += item.mem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.13.0",
3
+ "version": "5.13.1",
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)",