versions() added virtualbox

This commit is contained in:
Sebastian Hildebrandt 2019-05-29 23:41:35 +02:00
parent 1dc9d50bcf
commit e0570818eb
7 changed files with 36 additions and 26 deletions

View File

@ -30,6 +30,7 @@ For major (breaking) changes - version 3 and 2 see end of page.
| Version | Date | Comment |
| -------------- | -------------- | -------- |
| 4.7.2 | 2019-05-30 | `versions()` added virtualbox, java popup fix macos |
| 4.7.1 | 2019-05-29 | `memLayout()` fix macos mojave |
| 4.7.0 | 2019-05-29 | partial netBSD support |
| 4.6.1 | 2019-05-29 | get wmic path - fic windows |

View File

@ -80,6 +80,11 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">4.7.2</th>
<td>2019-05-30</td>
<td><span class="code">versions()</span> added virtualbox</td>
</tr>
<tr>
<th scope="row">4.7.1</th>
<td>2019-05-29</td>

View File

@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span></div>
<div class="version">Current Version: <span id="version">4.7.1</span></div>
<div class="version">Current Version: <span id="version">4.7.2</span></div>
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
</div>
<div class="down">

View File

@ -163,7 +163,7 @@ module.exports = function (callback) {
}
if (_windows) {
try {
util.wmic('Path Win32_Battery Get BatteryStatus, DesignCapacity, EstimatedChargeRemaining /value').then((stdout, error) => {
util.wmic('Path Win32_Battery Get BatteryStatus, DesignCapacity, EstimatedChargeRemaining /value').then((stdout) => {
if (stdout) {
let lines = stdout.split('\r\n');
let status = util.getValue(lines, 'BatteryStatus', '=').trim();

View File

@ -283,7 +283,7 @@ function osInfo(callback) {
result.logofile = getLogoFile();
result.release = result.kernel;
try {
util.wmic('os get /value').then((stdout, error) => {
util.wmic('os get /value').then((stdout) => {
let lines = stdout.toString().split('\r\n');
result.distro = util.getValue(lines, 'Caption', '=').trim();
result.serial = util.getValue(lines, 'SerialNumber', '=').trim();
@ -338,11 +338,12 @@ function versions(callback) {
pip: '',
pip3: '',
java: '',
gcc: ''
gcc: '',
virtualbox: ''
};
let functionProcessed = (function () {
let totalFunctions = 23;
let totalFunctions = 24;
return function () {
if (--totalFunctions === 0) {
if (callback) {
@ -517,7 +518,7 @@ function versions(callback) {
});
} else {
if (_windows) {
util.wmic('service get /value').then((stdout, error) => {
util.wmic('service get /value').then((stdout) => {
let serviceSections = stdout.split(/\n\s*\n/);
for (let i = 0; i < serviceSections.length; i++) {
if (serviceSections[i].trim() !== '') {
@ -585,14 +586,18 @@ function versions(callback) {
}
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() : '';
}
if (_darwin) {
functionProcessed();
});
} else {
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() || '';
@ -612,6 +617,14 @@ function versions(callback) {
});
}
});
exec('vboxmanage -v 2>&1', function (error, stdout) {
if (!error) {
const vbox = stdout.toString().split('\n')[0] || '';
const parts = vbox.split('r');
result.virtualbox = parts[0];
}
functionProcessed();
});
} catch (e) {
if (callback) { callback(result); }
resolve(result);

View File

@ -294,7 +294,6 @@ function bios(callback) {
resolve(result);
}
if (_windows) {
// TODO: check BIOS windows
try {
util.wmic('bios get /value').then((stdout, error) => {
if (!error) {

View File

@ -245,21 +245,13 @@ function wmic(command, options) {
process.nextTick(() => {
try {
exec(getWmic() + ' ' + command, options, function (error, stdout) {
resolve(stdout, error)
// resolve({
// stdout,
// error
// });
resolve(stdout, error);
}).stdin.end();
} catch (e) {
resolve('', e)
// resolve({
// stdout: '',
// error: e
// });
resolve('', e);
}
})
})
});
});
}
function powerShell(cmd) {