blockdevices() catching errors
This commit is contained in:
parent
e46e77570d
commit
b0d6e968ec
@ -30,6 +30,7 @@ For major (breaking) changes - version 3 and 2 see end of page.
|
||||
|
||||
| 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.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() |
|
||||
|
||||
@ -83,6 +83,11 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<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>
|
||||
<th scope="row">4.29.1</th>
|
||||
<td>2020-11-08</td>
|
||||
|
||||
@ -168,7 +168,7 @@
|
||||
<img class="logo" src="assets/logo.png">
|
||||
<div class="title">systeminformation</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>
|
||||
</div>
|
||||
<div class="down">
|
||||
|
||||
@ -135,6 +135,16 @@
|
||||
<td></td>
|
||||
<td>SKU number</td>
|
||||
</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">
|
||||
<td></td>
|
||||
<td colspan="7">
|
||||
|
||||
@ -268,30 +268,34 @@ function parseDevices(lines) {
|
||||
function parseBlk(lines) {
|
||||
let data = [];
|
||||
|
||||
lines.filter(line => line !== '').forEach((line) => {
|
||||
line = decodeURIComponent(line.replace(/\\x/g, '%'));
|
||||
line = line.replace(/\\/g, '\\\\');
|
||||
let disk = JSON.parse(line);
|
||||
data.push({
|
||||
'name': disk.name,
|
||||
'type': disk.type,
|
||||
'fstype': disk.fstype,
|
||||
'mount': disk.mountpoint,
|
||||
'size': parseInt(disk.size),
|
||||
'physical': (disk.type === 'disk' ? (disk.rota === '0' ? 'SSD' : 'HDD') : (disk.type === 'rom' ? 'CD/DVD' : '')),
|
||||
'uuid': disk.uuid,
|
||||
'label': disk.label,
|
||||
'model': disk.model,
|
||||
'serial': disk.serial,
|
||||
'removable': disk.rm === '1',
|
||||
'protocol': disk.tran,
|
||||
'group': disk.group,
|
||||
try {
|
||||
lines.filter(line => line !== '').forEach((line) => {
|
||||
line = decodeURIComponent(line.replace(/\\x/g, '%'));
|
||||
line = line.replace(/\\/g, '\\\\');
|
||||
let disk = JSON.parse(line);
|
||||
data.push({
|
||||
'name': disk.name,
|
||||
'type': disk.type,
|
||||
'fstype': disk.fstype,
|
||||
'mount': disk.mountpoint,
|
||||
'size': parseInt(disk.size),
|
||||
'physical': (disk.type === 'disk' ? (disk.rota === '0' ? 'SSD' : 'HDD') : (disk.type === 'rom' ? 'CD/DVD' : '')),
|
||||
'uuid': disk.uuid,
|
||||
'label': disk.label,
|
||||
'model': disk.model,
|
||||
'serial': disk.serial,
|
||||
'removable': disk.rm === '1',
|
||||
'protocol': disk.tran,
|
||||
'group': disk.group,
|
||||
});
|
||||
});
|
||||
});
|
||||
data = util.unique(data);
|
||||
data = util.sortByKey(data, ['type', 'name']);
|
||||
return data;
|
||||
} catch (e) {
|
||||
return [];
|
||||
}
|
||||
|
||||
data = util.unique(data);
|
||||
data = util.sortByKey(data, ['type', 'name']);
|
||||
return data;
|
||||
}
|
||||
|
||||
function blkStdoutToObject(stdout) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user