systeminformation 5.12.7 → 5.12.8

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
@@ -221,7 +221,6 @@ function osInfo(callback) {
221
221
  if (_linux) {
222
222
 
223
223
  exec('cat /etc/*-release; cat /usr/lib/os-release; cat /etc/openwrt_release', function (error, stdout) {
224
- //if (!error) {
225
224
  /**
226
225
  * @namespace
227
226
  * @property {string} DISTRIB_ID
@@ -259,7 +258,6 @@ function osInfo(callback) {
259
258
  resolve(result);
260
259
  });
261
260
  });
262
- //}
263
261
  });
264
262
  }
265
263
  if (_freebsd || _openbsd || _netbsd) {
package/lib/processes.js CHANGED
@@ -135,7 +135,7 @@ function services(srv, callback) {
135
135
 
136
136
  const s = util.sanitizeShellString(srv);
137
137
  for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
138
- if (!(s[i] === undefined)) {
138
+ if (s[i] !== undefined) {
139
139
  srvString = srvString + s[i];
140
140
  }
141
141
  }
@@ -171,7 +171,6 @@ function services(srv, callback) {
171
171
  const parts = s.split(']');
172
172
  if (parts.length === 2) {
173
173
  srvString += (srvString !== '' ? '|' : '') + parts[1].trim();
174
- // allSrv.push({ name: parts[1].trim(), running: parts[0].indexOf('+') > 0 });
175
174
  }
176
175
  }
177
176
  srvs = srvString.split('|');
@@ -185,13 +184,11 @@ function services(srv, callback) {
185
184
  const name = s.trim();
186
185
  if (name) {
187
186
  srvString += (srvString !== '' ? '|' : '') + name;
188
- // allSrv.push({ name: name, running: null });
189
187
  }
190
188
  }
191
189
  srvs = srvString.split('|');
192
190
  }
193
191
  } catch (f) {
194
- // allSrv = [];
195
192
  srvString = '';
196
193
  srvs = [];
197
194
  }
@@ -219,7 +216,6 @@ function services(srv, callback) {
219
216
  return (e.toLowerCase().indexOf(' ' + srv + ':') !== -1) || (e.toLowerCase().indexOf('/' + srv) !== -1);
220
217
  });
221
218
  }
222
- // let singleSrv = allSrv.filter(item => { return item.name === srv; });
223
219
  const pids = [];
224
220
  for (const p of ps) {
225
221
  const pid = p.trim().split(' ')[2];
@@ -229,7 +225,6 @@ function services(srv, callback) {
229
225
  }
230
226
  result.push({
231
227
  name: srv,
232
- // running: (allSrv.length && singleSrv.length && singleSrv[0].running !== null ? singleSrv[0].running : ps.length > 0),
233
228
  running: ps.length > 0,
234
229
  startmode: '',
235
230
  pids: pids,
@@ -288,10 +283,8 @@ function services(srv, callback) {
288
283
 
289
284
  // store old values
290
285
  _services_cpu.all = all;
291
- // _services_cpu.list = list_new;
292
286
  _services_cpu.list = Object.assign({}, list_new);
293
287
  _services_cpu.ms = Date.now() - _services_cpu.ms;
294
- // _services_cpu.result = result;
295
288
  _services_cpu.result = Object.assign({}, result);
296
289
  if (callback) { callback(result); }
297
290
  resolve(result);
@@ -786,10 +779,8 @@ function processes(callback) {
786
779
 
787
780
  // store old values
788
781
  _processes_cpu.all = all;
789
- // _processes_cpu.list = list_new;
790
782
  _processes_cpu.list = Object.assign({}, list_new);
791
783
  _processes_cpu.ms = Date.now() - _processes_cpu.ms;
792
- // _processes_cpu.result = result;
793
784
  _processes_cpu.result = Object.assign({}, result);
794
785
  if (callback) { callback(result); }
795
786
  resolve(result);
@@ -838,8 +829,6 @@ function processes(callback) {
838
829
  let list_new = {};
839
830
  let allcpuu = 0;
840
831
  let allcpus = 0;
841
- // let allcpuu = _processes_cpu.all_utime;
842
- // let allcpus = _processes_cpu.all_stime;
843
832
  for (let i = 0; i < processSections.length; i++) {
844
833
  if (processSections[i].trim() !== '') {
845
834
  let lines = processSections[i].trim().split('\r\n');
@@ -848,14 +837,24 @@ function processes(callback) {
848
837
  let statusValue = util.getValue(lines, 'ExecutionState', ':');
849
838
  let name = util.getValue(lines, 'Caption', ':', true);
850
839
  let commandLine = util.getValue(lines, 'CommandLine', ':', true);
840
+ // get additional command line data
841
+ let additionalCommand = false;
842
+ lines.forEach((line) => {
843
+ if (additionalCommand && line.toLowerCase().startsWith(' ')) {
844
+ commandLine = commandLine + line.trim();
845
+ } else {
846
+ additionalCommand = false;
847
+ }
848
+ if (line.toLowerCase().startsWith('commandline')) {
849
+ additionalCommand = true;
850
+ }
851
+ });
851
852
  let commandPath = util.getValue(lines, 'ExecutablePath', ':', true);
852
853
  let utime = parseInt(util.getValue(lines, 'UserModeTime', ':', true), 10);
853
854
  let stime = parseInt(util.getValue(lines, 'KernelModeTime', ':', true), 10);
854
855
  let memw = parseInt(util.getValue(lines, 'WorkingSetSize', ':', true), 10);
855
856
  allcpuu = allcpuu + utime;
856
857
  allcpus = allcpus + stime;
857
- // allcpuu += utime - (_processes_cpu.list[pid] ? _processes_cpu.list[pid].utime : 0);
858
- // allcpus += stime - (_processes_cpu.list[pid] ? _processes_cpu.list[pid].stime : 0);
859
858
  result.all++;
860
859
  if (!statusValue) { result.unknown++; }
861
860
  if (statusValue === '3') { result.running++; }
@@ -916,10 +915,8 @@ function processes(callback) {
916
915
  _processes_cpu.all = allcpuu + allcpus;
917
916
  _processes_cpu.all_utime = allcpuu;
918
917
  _processes_cpu.all_stime = allcpus;
919
- // _processes_cpu.list = list_new;
920
918
  _processes_cpu.list = Object.assign({}, list_new);
921
919
  _processes_cpu.ms = Date.now() - _processes_cpu.ms;
922
- // _processes_cpu.result = result;
923
920
  _processes_cpu.result = Object.assign({}, result);
924
921
  }
925
922
  if (callback) {
@@ -1009,8 +1006,6 @@ function processLoad(proc, callback) {
1009
1006
  let list_new = {};
1010
1007
  let allcpuu = 0;
1011
1008
  let allcpus = 0;
1012
- // let allcpuu = _process_cpu.all_utime;
1013
- // let allcpus = _process_cpu.all_stime;
1014
1009
 
1015
1010
  // go through all processes
1016
1011
  for (let i = 0; i < processSections.length; i++) {
@@ -1023,8 +1018,6 @@ function processLoad(proc, callback) {
1023
1018
  let mem = parseInt(util.getValue(lines, 'WorkingSetSize', ':', true), 10);
1024
1019
  allcpuu = allcpuu + utime;
1025
1020
  allcpus = allcpus + stime;
1026
- // allcpuu += utime - (_process_cpu.list[pid] ? _process_cpu.list[pid].utime : 0);
1027
- // allcpus += stime - (_process_cpu.list[pid] ? _process_cpu.list[pid].stime : 0);
1028
1021
 
1029
1022
  procStats.push({
1030
1023
  pid: pid,
@@ -1039,9 +1032,6 @@ function processLoad(proc, callback) {
1039
1032
  let pname = '';
1040
1033
  let inList = false;
1041
1034
  processes.forEach(function (proc) {
1042
- // console.log(proc)
1043
- // console.log(item)
1044
- // inList = inList || item.name.toLowerCase() === proc.toLowerCase();
1045
1035
  if (name.toLowerCase().indexOf(proc.toLowerCase()) >= 0 && !inList) {
1046
1036
  inList = true;
1047
1037
  pname = proc;
@@ -1072,7 +1062,6 @@ function processLoad(proc, callback) {
1072
1062
  // add missing processes
1073
1063
  if (processesString !== '*') {
1074
1064
  let processesMissing = processes.filter(function (name) {
1075
- // return procStats.filter(function(item) { return item.name.toLowerCase() === name }).length === 0;
1076
1065
  return procStats.filter(function (item) { return item.name.toLowerCase().indexOf(name) >= 0; }).length === 0;
1077
1066
 
1078
1067
  });
@@ -1111,7 +1100,6 @@ function processLoad(proc, callback) {
1111
1100
  _process_cpu.all = allcpuu + allcpus;
1112
1101
  _process_cpu.all_utime = allcpuu;
1113
1102
  _process_cpu.all_stime = allcpus;
1114
- // _process_cpu.list = list_new;
1115
1103
  _process_cpu.list = Object.assign({}, list_new);
1116
1104
  _process_cpu.ms = Date.now() - _process_cpu.ms;
1117
1105
  _process_cpu.result = JSON.parse(JSON.stringify(result));
@@ -1159,8 +1147,6 @@ function processLoad(proc, callback) {
1159
1147
  let inList = false;
1160
1148
  let name = '';
1161
1149
  for (let j = 0; j < result.length; j++) {
1162
- // if (result[j].proc.toLowerCase() === item.name.toLowerCase()) {
1163
- // if (result[j].proc.toLowerCase().indexOf(item.name.toLowerCase()) >= 0) {
1164
1150
  if (item.name.toLowerCase().indexOf(result[j].proc.toLowerCase()) >= 0) {
1165
1151
  listPos = j;
1166
1152
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.12.7",
3
+ "version": "5.12.8",
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)",