From 5e79107f905b1d60e79a099a04c1896c0ec99cc3 Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Wed, 21 Dec 2022 20:01:02 +0100 Subject: [PATCH] processes() commandLine missing spaces fix (windows) --- CHANGELOG.md | 1 + docs/history.html | 5 +++++ docs/index.html | 4 ++-- lib/processes.js | 2 +- lib/util.js | 33 ++++++--------------------------- 5 files changed, 15 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2954206..26a60fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -82,6 +82,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page. | Version | Date | Comment | | ------- | ---------- | --------------------------------------------------------------------------------------------------- | +| 5.16.7 | 2022-12-21 | `processes()` commandLine missing spaces fix (windows) | | 5.16.6 | 2022-12-12 | `processes()` time format fix (linux) | | 5.16.5 | 2022-12-09 | `inetLatency()` fix for alpine (linux) | | 5.16.4 | 2022-12-09 | `processes()` fix started (linux alpine) | diff --git a/docs/history.html b/docs/history.html index cb8cbe7..f7ac971 100644 --- a/docs/history.html +++ b/docs/history.html @@ -57,6 +57,11 @@ + + 5.16.7 + 2022-12-21 + processes() commandLine missing spaces fix (windows) + 5.16.6 2022-12-12 diff --git a/docs/index.html b/docs/index.html index 7f5f332..6140615 100644 --- a/docs/index.html +++ b/docs/index.html @@ -170,7 +170,7 @@
systeminformation
 
-
New Version: 5.16.6
+
New Version: 5.16.7
@@ -212,7 +212,7 @@
Downloads last month
-
586
+
588
Dependents
diff --git a/lib/processes.js b/lib/processes.js index 1636fc2..5a0da18 100644 --- a/lib/processes.js +++ b/lib/processes.js @@ -847,7 +847,7 @@ function processes(callback) { let additionalCommand = false; lines.forEach((line) => { if (additionalCommand && line.toLowerCase().startsWith(' ')) { - commandLine = commandLine + line.trim(); + commandLine += ' ' + line.trim(); } else { additionalCommand = false; } diff --git a/lib/util.js b/lib/util.js index 6f69364..0682155 100644 --- a/lib/util.js +++ b/lib/util.js @@ -28,7 +28,6 @@ const _windows = (_platform === 'win32'); const _freebsd = (_platform === 'freebsd'); const _openbsd = (_platform === 'openbsd'); const _netbsd = (_platform === 'netbsd'); -// const _sunos = (_platform === 'sunos'); let _cores = 0; let wmicPath = ''; @@ -288,7 +287,7 @@ function parseHead(head, rights) { cap: head.substring(from, to) }); let len = result.length; - for (var i = 0; i < len; i++) { + for (let i = 0; i < len; i++) { if (result[i].cap.replace(/\s/g, '').length === 0) { if (i + 1 < len) { result[i].to = result[i + 1].to; @@ -343,21 +342,6 @@ function wmic(command) { }); } -// function wmic(command, options) { -// options = options || execOptsWin; -// return new Promise((resolve) => { -// process.nextTick(() => { -// try { -// exec(WINDIR + '\\system32\\chcp.com 65001 | ' + getWmic() + ' ' + command, options, function (error, stdout) { -// resolve(stdout, error); -// }).stdin.end(); -// } catch (e) { -// resolve('', e); -// } -// }); -// }); -// } - function getVboxmanage() { return _windows ? `"${process.env.VBOX_INSTALL_PATH || process.env.VBOX_MSI_INSTALL_PATH}\\VBoxManage.exe"` : 'vboxmanage'; } @@ -384,8 +368,6 @@ function powerShellProceedResults(data) { for (let i = 0; i < _psCmds.length; i++) { if (_psCmds[i].id === id) { remove = i; - // console.log(`----- TIME : ${(new Date() - _psCmds[i].start) * 0.001} s`); - _psCmds[i].callback(res); } } @@ -469,7 +451,6 @@ function powerShell(cmd) { return new Promise((resolve) => { process.nextTick(() => { try { - // const start = new Date(); const child = spawn('powershell.exe', ['-NoLogo', '-InputFormat', 'Text', '-NoExit', '-ExecutionPolicy', 'Unrestricted', '-Command', '-'], { stdio: 'pipe', windowsHide: true, @@ -493,7 +474,6 @@ function powerShell(cmd) { }); child.on('close', function () { child.kill(); - // console.log(`----- TIME : ${(new Date() - start) * 0.001} s`); resolve(result); }); @@ -1014,7 +994,6 @@ function decodePiCpuinfo(lines) { } else { // new revision code const revision = ('00000000' + getValue(lines, 'revision', ':', true).toLowerCase()).substr(-8); - // const revisionStyleNew = hex2bin(revision.substr(2, 1)).substr(4, 1) === '1'; const memSizeCode = parseInt(hex2bin(revision.substr(2, 1)).substr(5, 3), 2) || 0; const manufacturer = manufacturerList[parseInt(revision.substr(3, 1), 10)]; const processor = processorList[parseInt(revision.substr(4, 1), 10)]; @@ -1038,7 +1017,7 @@ function decodePiCpuinfo(lines) { function promiseAll(promises) { const resolvingPromises = promises.map(function (promise) { return new Promise(function (resolve) { - var payload = new Array(2); + let payload = new Array(2); promise.then(function (result) { payload[0] = result; }) @@ -1051,8 +1030,8 @@ function promiseAll(promises) { }); }); }); - var errors = []; - var results = []; + const errors = []; + const results = []; // Execute all wrapped Promises return Promise.all(resolvingPromises) @@ -1076,7 +1055,7 @@ function promiseAll(promises) { function promisify(nodeStyleFunction) { return function () { - var args = Array.prototype.slice.call(arguments); + const args = Array.prototype.slice.call(arguments); return new Promise(function (resolve, reject) { args.push(function (err, data) { if (err) { @@ -1092,7 +1071,7 @@ function promisify(nodeStyleFunction) { function promisifySave(nodeStyleFunction) { return function () { - var args = Array.prototype.slice.call(arguments); + const args = Array.prototype.slice.call(arguments); return new Promise(function (resolve) { args.push(function (err, data) { resolve(data);