blockdevices() catching errors

This commit is contained in:
Sebastian Hildebrandt 2020-11-09 07:04:03 +01:00
parent e46e77570d
commit b0d6e968ec
5 changed files with 43 additions and 23 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.29.2 | 2020-11-09 | `blockdevices()` catch errors |
| 4.29.1 | 2020-11-08 | `cpu()`, `system()` better parsing Raspberry Pi revision codes | | 4.29.1 | 2020-11-08 | `cpu()`, `system()` better parsing Raspberry Pi revision codes |
| 4.29.0 | 2020-11-08 | `fsSize()` correct fs type detection macOS (HFS, APFS, NFS) | | 4.29.0 | 2020-11-08 | `fsSize()` correct fs type detection macOS (HFS, APFS, NFS) |
| 4.28.1 | 2020-11-05 | code cleanup, removing debug console.log() | | 4.28.1 | 2020-11-05 | code cleanup, removing debug console.log() |

View File

@ -83,6 +83,11 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr>
<th scope="row">4.29.2</th>
<td>2020-11-09</td>
<td><span class="code">blockdevices()</span> catch error</td>
</tr>
<tr> <tr>
<th scope="row">4.29.1</th> <th scope="row">4.29.1</th>
<td>2020-11-08</td> <td>2020-11-08</td>

View File

@ -168,7 +168,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.29.1</span></div> <div class="version">Current Version: <span id="version">4.29.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

@ -135,6 +135,16 @@
<td></td> <td></td>
<td>SKU number</td> <td>SKU number</td>
</tr> </tr>
<tr>
<td></td>
<td>raspberry</td>
<td>X</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>Additional Raspberry-specific information<br>manufacturer, processor, type, revision<br>Raspberry only</td>
</tr>
<tr class="example"> <tr class="example">
<td></td> <td></td>
<td colspan="7"> <td colspan="7">

View File

@ -268,6 +268,7 @@ function parseDevices(lines) {
function parseBlk(lines) { function parseBlk(lines) {
let data = []; let data = [];
try {
lines.filter(line => line !== '').forEach((line) => { lines.filter(line => line !== '').forEach((line) => {
line = decodeURIComponent(line.replace(/\\x/g, '%')); line = decodeURIComponent(line.replace(/\\x/g, '%'));
line = line.replace(/\\/g, '\\\\'); line = line.replace(/\\/g, '\\\\');
@ -288,10 +289,13 @@ function parseBlk(lines) {
'group': disk.group, 'group': disk.group,
}); });
}); });
data = util.unique(data); data = util.unique(data);
data = util.sortByKey(data, ['type', 'name']); data = util.sortByKey(data, ['type', 'name']);
return data; return data;
} catch (e) {
return [];
}
} }
function blkStdoutToObject(stdout) { function blkStdoutToObject(stdout) {