systeminformation 5.13.0 → 5.13.2

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/audio.js CHANGED
@@ -28,8 +28,10 @@ const _netbsd = (_platform === 'netbsd');
28
28
  const _sunos = (_platform === 'sunos');
29
29
 
30
30
  function parseAudioType(str, input, output) {
31
+ str = str.toLowerCase();
31
32
  let result = '';
32
33
 
34
+ if (str.indexOf('display audio') >= 0) { result = 'Speaker'; }
33
35
  if (str.indexOf('speak') >= 0) { result = 'Speaker'; }
34
36
  if (str.indexOf('laut') >= 0) { result = 'Speaker'; }
35
37
  if (str.indexOf('loud') >= 0) { result = 'Speaker'; }
@@ -55,15 +57,15 @@ function getLinuxAudioPci() {
55
57
  let result = [];
56
58
  try {
57
59
  const parts = execSync(cmd).toString().split('\n\n');
58
- for (let i = 0; i < parts.length; i++) {
59
- const lines = parts[i].split('\n');
60
+ parts.forEach(element => {
61
+ const lines = element.split('\n');
60
62
  if (lines && lines.length && lines[0].toLowerCase().indexOf('audio') >= 0) {
61
63
  const audio = {};
62
64
  audio.slotId = lines[0].split(' ')[0];
63
65
  audio.driver = util.getValue(lines, 'Kernel driver in use', ':', true) || util.getValue(lines, 'Kernel modules', ':', true);
64
66
  result.push(audio);
65
67
  }
66
- }
68
+ });
67
69
  return result;
68
70
  } catch (e) {
69
71
  return result;
@@ -154,13 +156,13 @@ function audio(callback) {
154
156
  if (!error) {
155
157
  const audioPCI = getLinuxAudioPci();
156
158
  const parts = stdout.toString().split('\n\n');
157
- for (let i = 0; i < parts.length; i++) {
158
- const lines = parts[i].split('\n');
159
+ parts.forEach(element => {
160
+ const lines = element.split('\n');
159
161
  if (util.getValue(lines, 'class', ':', true).toLowerCase().indexOf('audio') >= 0) {
160
162
  const audio = parseLinuxAudioPciMM(lines, audioPCI);
161
163
  result.push(audio);
162
164
  }
163
- }
165
+ });
164
166
  }
165
167
  if (callback) {
166
168
  callback(result);
@@ -194,11 +196,12 @@ function audio(callback) {
194
196
  util.powerShell('Get-CimInstance Win32_SoundDevice | select DeviceID,StatusInfo,Name,Manufacturer | fl').then((stdout, error) => {
195
197
  if (!error) {
196
198
  const parts = stdout.toString().split(/\n\s*\n/);
197
- for (let i = 0; i < parts.length; i++) {
198
- if (util.getValue(parts[i].split('\n'), 'name', ':')) {
199
- result.push(parseWindowsAudio(parts[i].split('\n')));
199
+ parts.forEach(element => {
200
+ const lines = element.split('\n');
201
+ if (util.getValue(lines, 'name', ':')) {
202
+ result.push(parseWindowsAudio(lines));
200
203
  }
201
- }
204
+ });
202
205
  }
203
206
  if (callback) {
204
207
  callback(result);
package/lib/cpu.js CHANGED
@@ -1044,13 +1044,15 @@ function cpuTemperature(callback) {
1044
1044
  const value = parts.length > 1 && parts[1] ? parts[1] : '0';
1045
1045
  if (value && (label === undefined || (label && label.toLowerCase().startsWith('core')))) {
1046
1046
  result.cores.push(Math.round(parseInt(value, 10) / 100) / 10);
1047
- } else if (value && label && result.main === null) {
1047
+ } else if (value && label && result.main === null && (label.toLowerCase().indexOf('package') >= 0 || label.toLowerCase().startsWith('physical') >= 0)) {
1048
1048
  result.main = Math.round(parseInt(value, 10) / 100) / 10;
1049
1049
  }
1050
1050
  });
1051
1051
 
1052
1052
  if (result.cores.length > 0) {
1053
- result.main = Math.round(result.cores.reduce((a, b) => a + b, 0) / result.cores.length);
1053
+ if (result.main === null) {
1054
+ result.main = Math.round(result.cores.reduce((a, b) => a + b, 0) / result.cores.length);
1055
+ }
1054
1056
  let maxtmp = Math.max.apply(Math, result.cores);
1055
1057
  result.max = (maxtmp > result.main) ? maxtmp : result.main;
1056
1058
  }
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.2",
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)",