From 932f9628724766ad5d0a4545ca4e9beea0634a88 Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Mon, 9 Nov 2020 08:27:15 +0100 Subject: [PATCH] blockdevices() catch errors adapted for just one line --- CHANGELOG.md | 1 + README.md | 2 +- docs/history.html | 5 +++++ docs/index.html | 6 +++--- lib/filesystem.js | 19 +++++++++---------- 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7d8bcd..df35446 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 adapted for just one line | | 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) | diff --git a/README.md b/README.md index d0f8f0b..a7c1385 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ [![Sponsoring][sponsor-badge]][sponsor-url] [![MIT license][license-img]][license-url] -This is amazing. Started as a small project just for myself, it now has > 9,000 lines of code, > 300 versions published, up to 2 mio downloads per month, > 20 mio downloads overall. Thank you to all who contributed to this project! +This is amazing. Started as a small project just for myself, it now has > 10,000 lines of code, > 350 versions published, up to 2 mio downloads per month, > 20 mio downloads overall. Thank you to all who contributed to this project! ## New Version 4.0 diff --git a/docs/history.html b/docs/history.html index b0a8768..a5530a5 100644 --- a/docs/history.html +++ b/docs/history.html @@ -83,6 +83,11 @@ + + 4.29.3 + 2020-11-09 + blockdevices() catch error adapted + 4.29.2 2020-11-09 diff --git a/docs/index.html b/docs/index.html index f8ae1ac..12ba2b1 100644 --- a/docs/index.html +++ b/docs/index.html @@ -168,7 +168,7 @@
systeminformation
-
Current Version: 4.29.2
+
Current Version: 4.29.3
@@ -199,7 +199,7 @@
-
9,988
+
10,943
Lines of code
@@ -208,7 +208,7 @@
359
-
Dependends
+
Dependents
diff --git a/lib/filesystem.js b/lib/filesystem.js index 0643064..e50ddff 100755 --- a/lib/filesystem.js +++ b/lib/filesystem.js @@ -268,8 +268,8 @@ function parseDevices(lines) { function parseBlk(lines) { let data = []; - try { - lines.filter(line => line !== '').forEach((line) => { + lines.filter(line => line !== '').forEach((line) => { + try { line = decodeURIComponent(line.replace(/\\x/g, '%')); line = line.replace(/\\/g, '\\\\'); let disk = JSON.parse(line); @@ -288,14 +288,13 @@ function parseBlk(lines) { 'protocol': disk.tran, 'group': disk.group, }); - }); - data = util.unique(data); - data = util.sortByKey(data, ['type', 'name']); - return data; - } catch (e) { - return []; - } - + } catch (e) { + util.noop(); + } + }); + data = util.unique(data); + data = util.sortByKey(data, ['type', 'name']); + return data; } function blkStdoutToObject(stdout) {