From a56a3dcb7fb3e2f5a45f07127aa936a99407e914 Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Fri, 21 Aug 2020 12:38:12 +0200 Subject: [PATCH] versions() fixed issue windows --- CHANGELOG.md | 1 + docs/history.html | 5 +++++ docs/index.html | 4 ++-- lib/osinfo.js | 25 +++++++++++++++++++++---- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75008be..b8d7160 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.12 | 2020-08-21 | `versions()` fixed issue windows | | 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 | diff --git a/docs/history.html b/docs/history.html index 6d4718a..ad76a74 100644 --- a/docs/history.html +++ b/docs/history.html @@ -83,6 +83,11 @@ + + 4.26.12 + 2020-08-21 + versions() fixed issue windows + 4.26.11 2020-08-20 diff --git a/docs/index.html b/docs/index.html index 284440d..3330e04 100644 --- a/docs/index.html +++ b/docs/index.html @@ -168,7 +168,7 @@
systeminformation
-
Current Version: 4.26.11
+
Current Version: 4.26.12
@@ -207,7 +207,7 @@
Downloads last month
-
328
+
330
Dependends
diff --git a/lib/osinfo.js b/lib/osinfo.js index 6022c85..446ea1c 100644 --- a/lib/osinfo.js +++ b/lib/osinfo.js @@ -443,6 +443,7 @@ function versions(apps, callback) { }; })(); + let cmd = ''; try { if ({}.hasOwnProperty.call(appsObj.versions, 'openssl')) { appsObj.versions.openssl = process.versions.openssl; @@ -465,7 +466,11 @@ function versions(apps, callback) { }); } if ({}.hasOwnProperty.call(appsObj.versions, 'pm2')) { - exec('pm2 -v', function (error, stdout) { + cmd = 'pm2'; + if (_windows) { + cmd += '.cmd'; + } + exec(`${cmd} -v`, function (error, stdout) { if (!error) { let pm2 = stdout.toString().split('\n')[0].trim(); if (!pm2.startsWith('[PM2]')) { @@ -484,7 +489,11 @@ function versions(apps, callback) { }); } if ({}.hasOwnProperty.call(appsObj.versions, 'gulp')) { - exec('gulp --version', function (error, stdout) { + cmd = 'gulp'; + if (_windows) { + cmd += '.cmd'; + } + exec(`${cmd} --version`, function (error, stdout) { if (!error) { const gulp = stdout.toString().split('\n')[0] || ''; appsObj.versions.gulp = (gulp.toLowerCase().split('version')[1] || '').trim(); @@ -493,7 +502,11 @@ function versions(apps, callback) { }); } if ({}.hasOwnProperty.call(appsObj.versions, 'tsc')) { - exec('tsc --version', function (error, stdout) { + cmd = 'tsc'; + if (_windows) { + cmd += '.cmd'; + } + exec(`${cmd} --version`, function (error, stdout) { if (!error) { const tsc = stdout.toString().split('\n')[0] || ''; appsObj.versions.tsc = (tsc.toLowerCase().split('version')[1] || '').trim(); @@ -502,7 +515,11 @@ function versions(apps, callback) { }); } if ({}.hasOwnProperty.call(appsObj.versions, 'grunt')) { - exec('grunt --version', function (error, stdout) { + cmd = 'grunt'; + if (_windows) { + cmd += '.cmd'; + } + exec(`${cmd} --version`, function (error, stdout) { if (!error) { const grunt = stdout.toString().split('\n')[0] || ''; appsObj.versions.grunt = (grunt.toLowerCase().split('cli v')[1] || '').trim();