bugfix windows processes(), disklayout()
This commit is contained in:
+2
-2
@@ -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;
|
||||
|
||||
+1
-1
@@ -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) {
|
||||
|
||||
+5
-1
@@ -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');
|
||||
|
||||
+2
-2
@@ -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 = [];
|
||||
|
||||
Reference in New Issue
Block a user