versions() added java, python3, optimized gcc
This commit is contained in:
Vendored
+2
@@ -222,6 +222,8 @@ export namespace Systeminformation {
|
||||
postgresql: string;
|
||||
perl: string;
|
||||
python: string;
|
||||
python3: string;
|
||||
java: string;
|
||||
gcc: string;
|
||||
}
|
||||
|
||||
|
||||
+32
-2
@@ -331,11 +331,13 @@ function versions(callback) {
|
||||
postgresql: '',
|
||||
perl: '',
|
||||
python: '',
|
||||
python3: '',
|
||||
java: '',
|
||||
gcc: ''
|
||||
};
|
||||
|
||||
let functionProcessed = (function () {
|
||||
let totalFunctions = 20;
|
||||
let totalFunctions = 21;
|
||||
return function () {
|
||||
if (--totalFunctions === 0) {
|
||||
if (callback) {
|
||||
@@ -555,11 +557,39 @@ function versions(callback) {
|
||||
}
|
||||
functionProcessed();
|
||||
});
|
||||
exec('python3 -V 2>&1', function (error, stdout) {
|
||||
if (!error) {
|
||||
const python = stdout.toString().split('\n')[0] || '';
|
||||
result.python3 = python.toLowerCase().replace('python', '').trim();
|
||||
}
|
||||
functionProcessed();
|
||||
});
|
||||
exec('java -version 2>&1', function (error, stdout) {
|
||||
if (!error) {
|
||||
const java = stdout.toString().split('\n')[0] || '';
|
||||
const parts = java.split('"');
|
||||
result.java = parts.length === 3 ? parts[1].trim() : '';
|
||||
}
|
||||
functionProcessed();
|
||||
});
|
||||
exec('gcc -dumpversion', function (error, stdout) {
|
||||
if (!error) {
|
||||
result.gcc = stdout.toString().split('\n')[0].trim() || '';
|
||||
}
|
||||
functionProcessed();
|
||||
if (result.gcc.indexOf('.') > -1) {
|
||||
functionProcessed();
|
||||
} else {
|
||||
exec('gcc --version', function (error, stdout) {
|
||||
if (!error) {
|
||||
const gcc = stdout.toString().split('\n')[0].trim();
|
||||
if (gcc.indexOf('gcc') > -1 && gcc.indexOf(')') > -1) {
|
||||
const parts = gcc.split(')');
|
||||
result.gcc = parts[1].trim() || result.gcc;
|
||||
}
|
||||
}
|
||||
functionProcessed();
|
||||
});
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
if (callback) { callback(result); }
|
||||
|
||||
Reference in New Issue
Block a user