From c6fccc0513d5df3109cd1e9c11a1978ae13086b1 Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Fri, 27 Nov 2020 16:05:56 +0100 Subject: [PATCH] wmic added default windows path (windows) --- CHANGELOG.md | 1 + docs/history.html | 5 +++++ docs/index.html | 2 +- lib/util.js | 6 ++++-- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f4f31d..e225e46 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.30.6 | 2020-11-27 | wmic added default windows path (windows) | | 4.30.5 | 2020-11-26 | adapted security update (prototype pollution prevention) | | 4.30.4 | 2020-11-25 | reverted Object.freeze because it broke some projects | | 4.30.3 | 2020-11-25 | security update (prototype pollution prevention) Object.freeze | diff --git a/docs/history.html b/docs/history.html index 87f3926..5150e24 100644 --- a/docs/history.html +++ b/docs/history.html @@ -83,6 +83,11 @@ + + 4.30.6 + 2020-11-27 + wmic added default windows path + 4.30.5 2020-11-26 diff --git a/docs/index.html b/docs/index.html index ac7add9..9df62e7 100644 --- a/docs/index.html +++ b/docs/index.html @@ -168,7 +168,7 @@
systeminformation
-
Current Version: 4.30.5
+
Current Version: 4.30.6
diff --git a/lib/util.js b/lib/util.js index 9d6b4e0..7a5692c 100644 --- a/lib/util.js +++ b/lib/util.js @@ -33,6 +33,8 @@ let _cores = 0; let wmicPath = ''; let codepage = ''; +const WINDIR = process.env.WINDIR || 'C:\\Windows'; + const execOptsWin = { windowsHide: true, maxBuffer: 1024 * 20000, @@ -295,7 +297,7 @@ function findObjectByKey(array, key, value) { function getWmic() { if (os.type() === 'Windows_NT' && !wmicPath) { - wmicPath = process.env.WINDIR + '\\system32\\wbem\\wmic.exe'; + wmicPath = WINDIR + '\\system32\\wbem\\wmic.exe'; if (!fs.existsSync(wmicPath)) { try { const wmicPathArray = execSync('WHERE WMIC').toString().split('\r\n'); @@ -317,7 +319,7 @@ function wmic(command, options) { return new Promise((resolve) => { process.nextTick(() => { try { - exec(process.env.WINDIR + '\\system32\\chcp.com 65001 | ' + getWmic() + ' ' + command, options, function (error, stdout) { + exec(WINDIR + '\\system32\\chcp.com 65001 | ' + getWmic() + ' ' + command, options, function (error, stdout) { resolve(stdout, error); }).stdin.end(); } catch (e) {