bugfix system() and flags() Raspberry Pi

This commit is contained in:
Sebastian Hildebrandt 2018-05-13 19:12:21 +02:00
parent 0a40b9d160
commit b4bdc820d7
4 changed files with 22 additions and 18 deletions

View File

@ -100,6 +100,7 @@ Other changes
| Version | Date | Comment | | Version | Date | Comment |
| -------------- | -------------- | -------- | | -------------- | -------------- | -------- |
| 3.41.2 | 2018-05-13 | bugfix `system()` and `flags()` Raspberry Pi |
| 3.41.1 | 2018-05-11 | updated docs | | 3.41.1 | 2018-05-11 | updated docs |
| 3.41.0 | 2018-05-11 | `system()` Raspberry Pi bugfix and extended detection, added partial `SunOS` support | | 3.41.0 | 2018-05-11 | `system()` Raspberry Pi bugfix and extended detection, added partial `SunOS` support |
| 3.40.1 | 2018-05-10 | bugfix `system().sku` (windows) | | 3.40.1 | 2018-05-10 | bugfix `system().sku` (windows) |

View File

@ -226,7 +226,7 @@ I also created a nice little command line tool called [mmon][mmon-github-url] (
| | release | X | X | X | X | X | | | | release | X | X | X | X | X | |
| | codename | | | X | | | | | | codename | | | X | | | |
| | kernel | X | X | X | X | X | kernel release - same as os.release() | | | kernel | X | X | X | X | X | kernel release - same as os.release() |
| | arch | X | X | X | X | | X | same as os.arch() | | | arch | X | X | X | X | X | same as os.arch() |
| | hostname | X | X | X | X | X | same as os.hostname() | | | hostname | X | X | X | X | X | same as os.hostname() |
| | logofile | X | X | X | X | X | e.g. 'apple', 'debian', 'fedora', ... | | | logofile | X | X | X | X | X | e.g. 'apple', 'debian', 'fedora', ... |
| si.versions(cb) | {...} | X | X | X | X | X | version information (kernel, ssl, node, ...) | | si.versions(cb) | {...} | X | X | X | X | X | version information (kernel, ssl, node, ...) |

View File

@ -613,9 +613,20 @@ function cpuFlags(callback) {
} }
}); });
} }
if (!result) {
exec('cat /proc/cpuinfo', function (error, stdout) {
if (!error) {
let lines = stdout.toString().split('\n');
result = util.getValue(lines, 'features', ':', true).toLowerCase();
}
if (callback) { callback(result); } if (callback) { callback(result); }
resolve(result); resolve(result);
}); });
} else {
if (callback) { callback(result); }
resolve(result);
}
});
} }
if (_freebsd || _openbsd) { if (_freebsd || _openbsd) {
exec('export LC_ALL=C; dmidecode -t 4; unset LC_ALL', function (error, stdout) { exec('export LC_ALL=C; dmidecode -t 4; unset LC_ALL', function (error, stdout) {
@ -631,20 +642,9 @@ function cpuFlags(callback) {
}); });
} }
result = flags.join(' ').trim(); result = flags.join(' ').trim();
if (!result) {
exec('cat /proc/cpuinfo', function (error, stdout) {
if (!error) {
let lines = stdout.toString().split('\n');
result = util.getValue(lines, 'features', ':', true).toLowerCase();
}
if (callback) { callback(result); } if (callback) { callback(result); }
resolve(result); resolve(result);
}); });
} else {
if (callback) { callback(result); }
resolve(result);
}
});
} }
if (_darwin) { if (_darwin) {
exec('sysctl machdep.cpu.features', function (error, stdout) { exec('sysctl machdep.cpu.features', function (error, stdout) {

View File

@ -63,7 +63,7 @@ function system(callback) {
if (fs.existsSync('/.dockerenv') || fs.existsSync('/.dockerinit')) { if (fs.existsSync('/.dockerenv') || fs.existsSync('/.dockerinit')) {
result.model = 'Docker Container'; result.model = 'Docker Container';
} }
if (result.manufacturer === '' && result.model === 'Computer' && result.version === '-') { // still default values if (result.manufacturer === '' && result.model === 'Computer' && result.version === '') { // still default values
exec('dmesg | grep -i virtual | grep -iE "vmware|qemu|kvm|xen"', function (error, stdout) { exec('dmesg | grep -i virtual | grep -iE "vmware|qemu|kvm|xen"', function (error, stdout) {
// detect virtual machines // detect virtual machines
if (!error) { if (!error) {
@ -162,6 +162,9 @@ function system(callback) {
resolve(result); resolve(result);
} }
}); });
} else {
if (callback) { callback(result); }
resolve(result);
} }
}); });
} }