versions() added perl, python, gcc

This commit is contained in:
Sebastian Hildebrandt 2018-12-29 17:10:06 +01:00
parent a9a9b3ae88
commit 1cd53f248b
2 changed files with 31 additions and 2 deletions

View File

@ -100,6 +100,7 @@ Other changes
| Version | Date | Comment |
| -------------- | -------------- | -------- |
| 3.53.0 | 2018-12-29 | `versions()` added perl, python, gcc |
| 3.52.7 | 2018-12-29 | `versions()` bug fix macOS detection |
| 3.52.6 | 2018-12-28 | `versions()` bug fix macOS |
| 3.52.5 | 2018-12-28 | preparing automated tests, travis-ci integration, added dev-dependencies |

View File

@ -299,11 +299,14 @@ function versions(callback) {
php: '',
docker: '',
postfix: '',
postgresql: ''
postgresql: '',
perl: '',
python: '',
gcc: ''
};
let functionProcessed = (function () {
let totalFunctions = 16;
let totalFunctions = 19;
return function () {
if (--totalFunctions === 0) {
if (callback) {
@ -477,6 +480,31 @@ function versions(callback) {
functionProcessed();
});
}
exec('perl -v', function (error, stdout) {
if (!error) {
const perl = stdout.toString().split('\n') || '';
while (perl.length > 0 && perl[0].trim() === '') {
perl.shift();
}
if (perl.length > 0) {
result.perl = perl[0].split('(').pop().split(')')[0].replace('v', '');
}
}
functionProcessed();
});
exec('python -V 2>&1', function (error, stdout) {
if (!error) {
const python = stdout.toString().split('\n')[0] || '';
result.python = python.toLowerCase().replace('python', '').trim();
}
functionProcessed();
});
exec('gcc -dumpversion', function (error, stdout) {
if (!error) {
result.gcc = stdout.toString().split('\n')[0].trim() || '';
}
functionProcessed();
});
} catch (e) {
if (callback) { callback(result); }
resolve(result);