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 |
| -------------- | -------------- | -------- |
| 3.41.2 | 2018-05-13 | bugfix `system()` and `flags()` Raspberry Pi |
| 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.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 | |
| | codename | | | X | | | |
| | 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() |
| | logofile | X | X | X | X | X | e.g. 'apple', 'debian', 'fedora', ... |
| si.versions(cb) | {...} | X | X | X | X | X | version information (kernel, ssl, node, ...) |

View File

@ -613,8 +613,19 @@ function cpuFlags(callback) {
}
});
}
if (callback) { callback(result); }
resolve(result);
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); }
resolve(result);
});
} else {
if (callback) { callback(result); }
resolve(result);
}
});
}
if (_freebsd || _openbsd) {
@ -631,19 +642,8 @@ function cpuFlags(callback) {
});
}
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); }
resolve(result);
});
} else {
if (callback) { callback(result); }
resolve(result);
}
if (callback) { callback(result); }
resolve(result);
});
}
if (_darwin) {

View File

@ -63,8 +63,8 @@ function system(callback) {
if (fs.existsSync('/.dockerenv') || fs.existsSync('/.dockerinit')) {
result.model = 'Docker Container';
}
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) {
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) {
// detect virtual machines
if (!error) {
let lines = stdout.toString().split('\n');
@ -162,6 +162,9 @@ function system(callback) {
resolve(result);
}
});
} else {
if (callback) { callback(result); }
resolve(result);
}
});
}