diff --git a/CHANGELOG.md b/CHANGELOG.md index fcab25c..444df95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,7 +30,8 @@ For major (breaking) changes - version 3 and 2 see end of page. | Version | Date | Comment | | -------------- | -------------- | -------- | -| 4.22.6 | 2020-03-08 | `network()` fixed DHCP linux, `diskLayout()` fixed linux | +| 4.22.7 | 2020-03-08 | `diskLayout()` fixed linux | +| 4.22.6 | 2020-03-08 | `network()` fixed DHCP linux| | 4.22.5 | 2020-03-04 | `graphics()` fixed vram macOS | | 4.22.4 | 2020-03-01 | `versions()` added dotnet, typings fix | | 4.22.3 | 2020-02-20 | `memLayout()` code cleanup | diff --git a/docs/history.html b/docs/history.html index cfe1638..667da45 100644 --- a/docs/history.html +++ b/docs/history.html @@ -83,6 +83,11 @@ + + 4.22.7 + 2020-03-08 + diskLayout() fixed detection (linux) + 4.22.6 2020-03-08 diff --git a/docs/index.html b/docs/index.html index 303449c..00bb927 100644 --- a/docs/index.html +++ b/docs/index.html @@ -168,7 +168,7 @@
systeminformation
-
Current Version: 4.22.6
+
Current Version: 4.22.7
diff --git a/lib/filesystem.js b/lib/filesystem.js old mode 100644 new mode 100755 index 5ff3e38..f64c513 --- a/lib/filesystem.js +++ b/lib/filesystem.js @@ -722,11 +722,13 @@ function diskLayout(callback) { ]; let result = ''; - model = model.toUpperCase(); - diskManufacturers.forEach((manufacturer) => { - const re = RegExp(manufacturer.pattern); - if (re.test(model)) { result = manufacturer.manufacturer; } - }); + if (model) { + model = model.toUpperCase(); + diskManufacturers.forEach((manufacturer) => { + const re = RegExp(manufacturer.pattern); + if (re.test(model)) { result = manufacturer.manufacturer; } + }); + } return result; } @@ -745,21 +747,21 @@ function diskLayout(callback) { try { const outJSON = JSON.parse(out); if (outJSON && {}.hasOwnProperty.call(outJSON, 'blockdevices')) { - devices = outJSON.blockdevices.filter(item => { return item.group === 'disk' && item.size > 0 && (item.model !== null || (item.mountpoint === null && item.label === null && item.fstype === null)); }); + devices = outJSON.blockdevices.filter(item => { return (item.group === 'disk' || item.type === 'disk') && item.size > 0 && (item.model !== null || (item.mountpoint === null && item.label === null && item.fstype === null)); }); } } catch (e) { // fallback to older version of lsblk const out2 = execSync('export LC_ALL=C; lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,LABEL,MODEL,OWNER,GROUP 2>/dev/null; unset LC_ALL').toString(); let lines = blkStdoutToObject(out2).split('\n'); const data = parseBlk(lines); - devices = data.filter(item => { return item.group === 'disk' && item.size > 0 && ((item.model !== null && item.model !== '') || (item.mountpoint === '' && item.label === '' && item.fstype === '')); }); + devices = data.filter(item => { return (item.group === 'disk' || item.type === 'disk') && item.size > 0 && ((item.model !== null && item.model !== '') || (item.mountpoint === '' && item.label === '' && item.fstype === '')); }); } devices.forEach((device) => { let mediumType = ''; const BSDName = '/dev/' + device.name; const logical = device.name; try { - mediumType = execSync('cat /sys/block/' + logical + '/queue/rotational').toString().split('\n')[0]; + mediumType = execSync('cat /sys/block/' + logical + '/queue/rotational 2>/dev/null').toString().split('\n')[0]; } catch (e) { util.noop(); } @@ -793,8 +795,6 @@ function diskLayout(callback) { util.noop(); } } - // lshw sometimes returns empty results, try lsblk - // check S.M.A.R.T. status if (cmd) { cmd = cmd + 'printf "\n"';