bugfix diskLayout()

This commit is contained in:
Sebastian Hildebrandt 2017-07-13 08:14:12 +02:00
parent 88cac2d1e4
commit 12cde2f040
3 changed files with 22 additions and 10 deletions

View File

@ -98,7 +98,8 @@ Other changes
| Version | Date | Comment |
| -------------- | -------------- | -------- |
| 3.23.6 | 2017-07-11 | added cpuFlags() to getStaticData(), bug fix `graphics()` (Win) |
| 3.23.7 | 2017-07-11 | bug fix `diskLayout()` |
| 3.23.6 | 2017-07-11 | added `cpuFlags()` to `getStaticData()`, bug fix `graphics()` (Win) |
| 3.23.5 | 2017-06-29 | bug fix `inetChecksite()` |
| 3.23.4 | 2017-06-24 | bug fix `getDynamicData(), getAllData() - mem` |
| 3.23.3 | 2017-06-23 | updated docs |

View File

@ -117,7 +117,7 @@ function getCpu() {
});
}
if (_linux) {
exec("lscpu", function (error, stdout) {
exec("export LC_ALL=C; lscpu; unset LC_ALL", function (error, stdout) {
if (!error) {
let lines = stdout.toString().split('\n');
const modelline = getValue(lines, 'model name');
@ -135,11 +135,11 @@ function getCpu() {
result = cpuBrandManufacturer(result);
result.vendor = getValue(lines, 'vendor id');
if (!result.vendor) { result.vendor = getValue(lines, 'anbieterkennung'); }
// if (!result.vendor) { result.vendor = getValue(lines, 'anbieterkennung'); }
result.family = getValue(lines, 'cpu family');
if (!result.family) { result.family = getValue(lines, 'prozessorfamilie'); }
// if (!result.family) { result.family = getValue(lines, 'prozessorfamilie'); }
result.model = getValue(lines, 'model:');
if (!result.model) { result.model = getValue(lines, 'modell:'); }
// if (!result.model) { result.model = getValue(lines, 'modell:'); }
result.stepping = getValue(lines, 'stepping');
result.revision = getValue(lines, 'cpu revision');
result.cache.l1d = getValue(lines, 'l1d cache');

View File

@ -590,14 +590,19 @@ function diskLayout(callback) {
let result = [];
if (_linux) {
exec("lshw -class disk", function (error, stdout) {
exec("export LC_ALL=C; lshw -class disk; unset LC_ALL", function (error, stdout) {
if (!error) {
let devices = stdout.toString().split('*-');
devices.shift();
devices.forEach(function (device) {
let lines = device.split('\n');
let mediumType = '';
const logical = getValue(lines, 'logical name', ':', true).trim().replace(/\/dev\//g, '');
const mediumType = execSync('cat /sys/block/' + logical + '/queue/rotational').toString().split('\n')[0];
try {
mediumType = execSync('cat /sys/block/' + logical + '/queue/rotational').toString().split('\n')[0];
} catch (e) {
}
const size = getValue(lines, 'size', ':', true).trim();
if (size && lines.length > 0 && lines[0].trim() === 'disk') {
result.push({
@ -619,7 +624,9 @@ function diskLayout(callback) {
}
});
}
if (callback) { callback(result) }
if (callback) {
callback(result)
}
resolve(result);
});
}
@ -659,7 +666,9 @@ function diskLayout(callback) {
}
});
}
if (callback) { callback(result) }
if (callback) {
callback(result)
}
resolve(result);
});
}
@ -691,7 +700,9 @@ function diskLayout(callback) {
}
});
}
if (callback) { callback(result) }
if (callback) {
callback(result)
}
resolve(result);
});
}