From ffa1a4e6a9ce93653dd973c51aafc94b496bf62e Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Thu, 20 Aug 2020 18:25:34 +0200 Subject: [PATCH] cpuTemperature() fixed issue windows --- CHANGELOG.md | 1 + docs/history.html | 5 +++++ docs/index.html | 4 ++-- lib/cpu.js | 2 ++ lib/docker.js | 2 +- lib/network.js | 14 +++++++------- lib/osinfo.js | 4 ++-- lib/util.js | 6 +++++- 8 files changed, 25 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 488eaca..75008be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ For major (breaking) changes - version 3 and 2 see end of page. | Version | Date | Comment | | -------------- | -------------- | -------- | +| 4.26.11 | 2020-08-20 | `cpuTemperature()` fixed issue windows | | 4.26.10 | 2020-07-16 | `networkStats()` fixed issue blocking windows | | 4.26.9 | 2020-06-06 | `networkStats()` fixed comparison issue windows | | 4.26.8 | 2020-06-06 | `networkInterfaces()` fixed caching issue | diff --git a/docs/history.html b/docs/history.html index 3f1f402..6d4718a 100644 --- a/docs/history.html +++ b/docs/history.html @@ -83,6 +83,11 @@ + + 4.26.11 + 2020-08-20 + cpuTemperature() fixed issue windows + 4.26.10 2020-07-16 diff --git a/docs/index.html b/docs/index.html index da715ef..284440d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -168,7 +168,7 @@
systeminformation
-
Current Version: 4.26.10
+
Current Version: 4.26.11
@@ -207,7 +207,7 @@
Downloads last month
-
304
+
328
Dependends
diff --git a/lib/cpu.js b/lib/cpu.js index 7113727..22d9cd4 100644 --- a/lib/cpu.js +++ b/lib/cpu.js @@ -784,6 +784,7 @@ function cpuTemperature(callback) { } if (callback) { callback(result); } resolve(result); + return; } } exec('sensors', function (error, stdout) { @@ -819,6 +820,7 @@ function cpuTemperature(callback) { if (result.main !== -1.0 || result.max !== -1.0) { if (callback) { callback(result); } resolve(result); + return; } } fs.stat('/sys/class/thermal/thermal_zone0/temp', function (err) { diff --git a/lib/docker.js b/lib/docker.js index 32b1666..22d69a3 100644 --- a/lib/docker.js +++ b/lib/docker.js @@ -62,7 +62,7 @@ function dockerInfo(callback) { result.cgroupDriver = data.CgroupDriver; result.nEventsListener = data.NEventsListener; result.kernelVersion = data.KernelVersion; - result.pperatingSystem = data.OperatingSystem; + result.operatingSystem = data.OperatingSystem; result.osType = data.OSType; result.architecture = data.Architecture; result.ncpu = data.NCPU; diff --git a/lib/network.js b/lib/network.js index c44d329..0af8932 100644 --- a/lib/network.js +++ b/lib/network.js @@ -586,13 +586,13 @@ function getLinuxIfaceDHCPstatus(iface, connectionName, DHCPNics) { let dhcStatus = resultFormat.split(' ').slice(1).toString(); switch (dhcStatus) { - case 'auto': - result = true; - break; + case 'auto': + result = true; + break; - default: - result = false; - break; + default: + result = false; + break; } return result; } catch (e) { @@ -679,7 +679,7 @@ function testVirtualNic(iface, ifaceName, mac) { function networkInterfaces(callback, rescan = true) { - if (typeof callback === "boolean") { + if (typeof callback === 'boolean') { rescan = callback; callback = null; } diff --git a/lib/osinfo.js b/lib/osinfo.js index 9d373a9..6022c85 100644 --- a/lib/osinfo.js +++ b/lib/osinfo.js @@ -324,8 +324,7 @@ function isUefiLinux() { fs.stat('/sys/firmware/efi', function (err) { if (!err) { resolve(true); - } - else { + } else { resolve(false); } }); @@ -341,6 +340,7 @@ function isUefiWindows() { if (!error) { const line = stdout.toString().split('\n\r')[0]; resolve(line.toLowerCase().indexOf('uefi') >= 0); + return; } resolve(false); }); diff --git a/lib/util.js b/lib/util.js index 30b268c..622531d 100644 --- a/lib/util.js +++ b/lib/util.js @@ -332,7 +332,11 @@ function powerShell(cmd) { process.nextTick(() => { try { const child = spawn('powershell.exe', ['-NoLogo', '-InputFormat', 'Text', '-NoExit', '-ExecutionPolicy', 'Unrestricted', '-Command', '-'], { - stdio: 'pipe' + stdio: 'pipe', + windowsHide: true, + maxBuffer: 1024 * 20000, + encoding: 'UTF-8', + env: util._extend({}, process.env, { LANG: 'en_US.UTF-8' }) }); if (child && !child.pid) {