From eddd522abf266a39aca9a836261f10e9aade252b Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Thu, 22 Feb 2018 21:38:42 +0100 Subject: [PATCH] bugfix windows processes(), disklayout() --- CHANGELOG.md | 1 + README.md | 2 +- lib/cpu.js | 4 ++-- lib/filesystem.js | 2 +- lib/internet.js | 6 +++++- lib/processes.js | 4 ++-- 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc9a9f6..840e0c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 | diff --git a/README.md b/README.md index 276a4b1..a866a1d 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/lib/cpu.js b/lib/cpu.js index 4a25bb7..7953948 100644 --- a/lib/cpu.js +++ b/lib/cpu.js @@ -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; diff --git a/lib/filesystem.js b/lib/filesystem.js index 08e893d..3fb2fe6 100644 --- a/lib/filesystem.js +++ b/lib/filesystem.js @@ -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) { diff --git a/lib/internet.js b/lib/internet.js index eb86f09..d969942 100644 --- a/lib/internet.js +++ b/lib/internet.js @@ -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'); diff --git a/lib/processes.js b/lib/processes.js index a123032..ee72aa2 100644 --- a/lib/processes.js +++ b/lib/processes.js @@ -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 = [];