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 | | 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.1 | 2019-05-29 | `memLayout()` fix macos mojave |
| 4.7.0 | 2019-05-29 | partial netBSD support | | 4.7.0 | 2019-05-29 | partial netBSD support |
| 4.6.1 | 2019-05-29 | get wmic path - fic windows | | 4.6.1 | 2019-05-29 | get wmic path - fic windows |

View File

@ -80,6 +80,11 @@
</tr> </tr>
</thead> </thead>
<tbody> <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> <tr>
<th scope="row">4.7.1</th> <th scope="row">4.7.1</th>
<td>2019-05-29</td> <td>2019-05-29</td>

View File

@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png"> <img class="logo" src="assets/logo.png">
<div class="title">systeminformation</div> <div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span></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> <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>
<div class="down"> <div class="down">

View File

@ -163,7 +163,7 @@ module.exports = function (callback) {
} }
if (_windows) { if (_windows) {
try { 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) { if (stdout) {
let lines = stdout.split('\r\n'); let lines = stdout.split('\r\n');
let status = util.getValue(lines, 'BatteryStatus', '=').trim(); let status = util.getValue(lines, 'BatteryStatus', '=').trim();

View File

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

View File

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

View File

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