getDynamicData() fixed windows WSL issue
This commit is contained in:
parent
aae4b37442
commit
06da4917bb
@ -30,6 +30,7 @@ For major (breaking) changes - version 3 and 2 see end of page.
|
||||
|
||||
| Version | Date | Comment |
|
||||
| -------------- | -------------- | -------- |
|
||||
| 5.0.10 | 2020-02-06 | `getDynamicData()` fixed windows WSL issue |
|
||||
| 5.0.9 | 2020-02-02 | `fsSize()` fixed parsing edge case issue mac OS |
|
||||
| 5.0.8 | 2020-01-30 | typescript typings fix cpuCurrentSpeed |
|
||||
| 5.0.7 | 2020-01-29 | `fsSize()` available fixed windows and typescript typings |
|
||||
|
||||
@ -56,6 +56,11 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">5.0.10</th>
|
||||
<td>2020-02-06</td>
|
||||
<td><span class="code">getDynamicData()</span> windows WSL fix</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">5.0.9</th>
|
||||
<td>2020-02-02</td>
|
||||
|
||||
@ -170,7 +170,7 @@
|
||||
<img class="logo" src="assets/logo.png">
|
||||
<div class="title">systeminformation</div>
|
||||
<div class="subtitle"><span id="typed"></span> </div>
|
||||
<div class="version">New Version: <span id="version">5.0.9</span></div>
|
||||
<div class="version">New Version: <span id="version">5.0.10</span></div>
|
||||
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
|
||||
</div>
|
||||
<div class="down">
|
||||
|
||||
@ -196,6 +196,17 @@ function fsOpenFiles(callback) {
|
||||
if (!result.available) { result.available = result.max - result.allocated; }
|
||||
}
|
||||
}
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
} else {
|
||||
fs.readFile('/proc/sys/fs/file-max', function (error, stdout) {
|
||||
if (!error) {
|
||||
let lines = stdout.toString().split('\n');
|
||||
if (lines[0]) {
|
||||
result.max = parseInt(lines[0], 10);
|
||||
}
|
||||
}
|
||||
if (callback) {
|
||||
callback(result);
|
||||
@ -203,6 +214,8 @@ function fsOpenFiles(callback) {
|
||||
resolve(result);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
if (_sunos) {
|
||||
if (callback) { callback(null); }
|
||||
resolve(null);
|
||||
|
||||
@ -186,7 +186,7 @@ function services(srv, callback) {
|
||||
}
|
||||
result.push({
|
||||
name: srv,
|
||||
// running: (allSrv.length && singleSrv.length && singleSrv[0].running !== null ? singleSrv[0].running : ps.length > 0),
|
||||
// running: (allSrv.length && singleSrv.length && singleSrv[0].running !== null ? singleSrv[0].running : ps.length > 0),
|
||||
running: ps.length > 0,
|
||||
startmode: '',
|
||||
pids: pids,
|
||||
@ -305,10 +305,11 @@ function services(srv, callback) {
|
||||
if (serviceSections[i].trim() !== '') {
|
||||
let lines = serviceSections[i].trim().split('\r\n');
|
||||
let srvName = util.getValue(lines, 'Name', '=', true).toLowerCase();
|
||||
let srvCaption = util.getValue(lines, 'Caption', '=', true).toLowerCase();
|
||||
let started = util.getValue(lines, 'Started', '=', true);
|
||||
let startMode = util.getValue(lines, 'StartMode', '=', true);
|
||||
let pid = util.getValue(lines, 'ProcessId', '=', true);
|
||||
if (srvString === '*' || srvs.indexOf(srvName) >= 0) {
|
||||
if (srvString === '*' || srvs.indexOf(srvName) >= 0 || srvs.indexOf(srvCaption) >= 0) {
|
||||
result.push({
|
||||
name: srvName,
|
||||
running: (started === 'TRUE'),
|
||||
@ -318,6 +319,7 @@ function services(srv, callback) {
|
||||
mem: 0
|
||||
});
|
||||
dataSrv.push(srvName);
|
||||
dataSrv.push(srvCaption);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -358,8 +360,8 @@ function services(srv, callback) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (callback) { callback({}); }
|
||||
resolve({});
|
||||
if (callback) { callback([]); }
|
||||
resolve([]);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
const exec = require('child_process').exec;
|
||||
const execSync = require('child_process').execSync;
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
const util = require('./util');
|
||||
|
||||
let _platform = process.platform;
|
||||
@ -120,6 +121,15 @@ function system(callback) {
|
||||
util.noop();
|
||||
}
|
||||
}
|
||||
if (!result.virtual && os.version().toLowerCase().indexOf('microsoft') >= 0) {
|
||||
let versionStr = os.version().toLowerCase();
|
||||
versionStr = versionStr.split('-')[0].replace('#', '');
|
||||
const version = parseInt(versionStr, 10) || null;
|
||||
result.virtual = true;
|
||||
result.manufacturer = 'Microsoft';
|
||||
result.model = 'WSL';
|
||||
result.version = version;
|
||||
}
|
||||
if ((_freebsd || _openbsd || _netbsd) && !result.virtualHost) {
|
||||
try {
|
||||
const procInfo = execSync('dmidecode -t 4');
|
||||
|
||||
@ -251,6 +251,11 @@ function wifiNetworks(callback) {
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
} else {
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
} catch (e) {
|
||||
if (callback) {
|
||||
|
||||
@ -27,9 +27,9 @@ function test(f) {
|
||||
else if (f === 'M') { si.memLayout().then(data => { if (data !== null) { resolve({ data, title: 'Memory Layout' }); } else { resolve('not_supported'); } }); }
|
||||
else if (f === 'o') { si.osInfo().then(data => { if (data !== null) { resolve({ data, title: 'OS Info' }); } else { resolve('not_supported'); } }); }
|
||||
else if (f === 'p') { si.processes().then(data => { if (data !== null) { resolve({ data, title: 'Processes' }); } else { resolve('not_supported'); } }); }
|
||||
else if (f === 'P') { si.processLoad('postgres, login, apache, mysql, nginx, git').then(data => { if (data !== null) { resolve({ data, title: 'Process Load' }); } else { resolve('not_supported'); } }); }
|
||||
else if (f === 'P') { si.processLoad('postgres, login, apache, mysql, nginx, git, node').then(data => { if (data !== null) { resolve({ data, title: 'Process Load' }); } else { resolve('not_supported'); } }); }
|
||||
else if (f === 'r') { si.printer().then(data => { if (data !== null) { resolve({ data, title: 'Printer' }); } else { resolve('not_supported'); } }); }
|
||||
else if (f === 's') { si.services('apache2, postgres').then(data => { if (data !== null) { resolve({ data, title: 'Services' }); } else { resolve('not_supported'); } }); }
|
||||
else if (f === 's') { si.services('apache2, postgres, wsearch').then(data => { if (data !== null) { resolve({ data, title: 'Services' }); } else { resolve('not_supported'); } }); }
|
||||
else if (f === 'S') { si.shell().then(data => { if (data !== null) { resolve({ data, title: 'Shell' }); } else { resolve('not_supported'); } }); }
|
||||
else if (f === 't') { resolve({ data: si.time(), title: 'Time' }); }
|
||||
else if (f === 'T') { si.cpuTemperature().then(data => { if (data !== null) { resolve({ data, title: 'CPU Temperature' }); } else { resolve('not_supported'); } }); }
|
||||
@ -52,8 +52,8 @@ function test(f) {
|
||||
else if (f === '9') { si.dockerContainerProcesses('1').then(data => { if (data !== null) { resolve({ data, title: 'Docker Cont Processes' }); } else { resolve('not_supported'); } }); }
|
||||
else if (f === '0') { si.dockerAll().then(data => { if (data !== null) { resolve({ data, title: 'Docker All' }); } else { resolve('not_supported'); } }); }
|
||||
else if (f === ',') { si.getStaticData().then(data => { if (data !== null) { resolve({ data, title: 'All Static Data' }); } else { resolve('not_supported'); } }); }
|
||||
else if (f === '.') { si.getDynamicData('apache2, postgres').then(data => { if (data !== null) { resolve({ data, title: 'All Dynamic Data' }); } else { resolve('not_supported'); } }); }
|
||||
else if (f === '/') { si.getAllData('apache2, postgres').then(data => { if (data !== null) { resolve({ data, title: 'All Data' }); } else { resolve('not_supported'); } }); }
|
||||
else if (f === '.') { si.getDynamicData('apache2, postgres, wsearch').then(data => { if (data !== null) { resolve({ data, title: 'All Dynamic Data' }); } else { resolve('not_supported'); } }); }
|
||||
else if (f === '/') { si.getAllData('apache2, postgres, wsearch').then(data => { if (data !== null) { resolve({ data, title: 'All Data' }); } else { resolve('not_supported'); } }); }
|
||||
else if (f === '?') {
|
||||
const valueObject = {
|
||||
cpu: '*',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user