bugfix windows processes(), disklayout()

This commit is contained in:
Sebastian Hildebrandt 2018-02-22 21:38:42 +01:00
parent 517a1d4721
commit eddd522abf
6 changed files with 12 additions and 7 deletions

View File

@ -100,6 +100,7 @@ Other changes
| Version | Date | Comment |
| -------------- | -------------- | -------- |
| 3.37.4 | 2018-02-22 | bugfix windows `processes()`, `disklayout()` |
| 3.37.3 | 2018-02-19 | added windows exec `windowsHide` option |
| 3.37.2 | 2018-02-15 | fixed bug `battery().percent` for macOS |
| 3.37.1 | 2018-02-13 | fixed bug `battery().ischarging` for macOS |

View File

@ -559,7 +559,7 @@ Written by Sebastian Hildebrandt [sebhildebrandt](https://github.com/sebhildebra
- Tiago Roldão [tiagoroldao](https://github.com/tiagoroldao)
- dragonjet [dragonjet](https://github.com/dragonjet)
- Adam Reis [adamreisnz](https://github.com/adamreisnz)
- Jimmi M [ItsJimi](https://github.com/ItsJimi)
- Jimi M [ItsJimi](https://github.com/ItsJimi)
OSX Temperature: credits here are going to:

View File

@ -571,7 +571,7 @@ function cpuFlags(callback) {
process.nextTick(() => {
let result = '';
if (_windows) {
exec('reg query "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0" /v FeatureSet', function (error, stdout) {
exec('reg query "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0" /v FeatureSet', opts, function (error, stdout) {
if (!error) {
let flag_hex = stdout.split('0x').pop().trim();
let flag_bin_unpadded = parseInt(flag_hex, 16).toString(2);
@ -737,7 +737,7 @@ function cpuCache(callback) {
});
}
if (_windows) {
exec(util.getWmic() + ' cpu get l2cachesize, l3cachesize /value', function (error, stdout) {
exec(util.getWmic() + ' cpu get l2cachesize, l3cachesize /value', opts, function (error, stdout) {
if (!error) {
let lines = stdout.split('\r\n');
result.l1d = 0;

View File

@ -716,7 +716,7 @@ function diskLayout(callback) {
}
if (_windows) {
exec(util.getWmic() + ' diskdrive get /value', {encoding: 'utf8'}, opts, function (error, stdout) {
exec(util.getWmic() + ' diskdrive get /value', {encoding: 'utf8', windowsHide: true}, function (error, stdout) {
if (!error) {
let devices = stdout.toString().split(/\n\s*\n/);
devices.forEach(function (device) {

View File

@ -23,6 +23,10 @@ const _windows = (_platform === 'win32');
const _freebsd = (_platform === 'freebsd');
const _openbsd = (_platform === 'openbsd');
const opts = {
windowsHide: true
};
// --------------------------
// check if external site is available
@ -136,7 +140,7 @@ function inetLatency(host, callback) {
});
}
if (_windows) {
exec('ping ' + host + ' -n 1', function (error, stdout) {
exec('ping ' + host + ' -n 1', opts, function (error, stdout) {
let result = -1;
if (!error) {
let lines = stdout.toString().split('\r\n');

View File

@ -124,7 +124,7 @@ function services(srv, callback) {
}
}
if (_windows) {
exec(util.getWmic() + ' service get /value', {maxBuffer: 1024 * 1000}, opts, function (error, stdout) {
exec(util.getWmic() + ' service get /value', {maxBuffer: 1024 * 1000, windowsHide: true}, function (error, stdout) {
if (!error) {
let serviceSections = stdout.split(/\n\s*\n/);
for (let i = 0; i < serviceSections.length; i++) {
@ -493,7 +493,7 @@ function processes(callback) {
});
}
if (_windows) {
exec(util.getWmic() + ' process get /value', {maxBuffer: 1024 * 1000}, opts, function (error, stdout) {
exec(util.getWmic() + ' process get /value', {maxBuffer: 1024 * 1000, windowsHide: true}, function (error, stdout) {
if (!error) {
let processSections = stdout.split(/\n\s*\n/);
let procs = [];