versions() fixed issue windows

This commit is contained in:
Sebastian Hildebrandt
2020-08-21 12:38:12 +02:00
parent 7956133fa7
commit a56a3dcb7f
4 changed files with 29 additions and 6 deletions
+21 -4
View File
@@ -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();