From 5723e81e8185f5840ca638f9ee5a8b54cc14cc92 Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Tue, 11 Feb 2020 00:05:11 +0100 Subject: [PATCH] networkConnections() fixed linux (debian) issue --- CHANGELOG.md | 1 + docs/history.html | 5 +++++ docs/index.html | 4 ++-- lib/network.js | 4 ++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72b8522..c347228 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.21.2 | 2020-02-11 | `networkConnections()` fixed linux (debian) issue | | 4.21.1 | 2020-01-31 | `networkGatewayDefault()` fixed windows 7 issue | | 4.21.0 | 2020-01-27 | `npx` compatibility | | 4.20.1 | 2020-01-26 | `battery()` code refactoring, cleanup, updated docs | diff --git a/docs/history.html b/docs/history.html index 8eab5a7..974c0f3 100644 --- a/docs/history.html +++ b/docs/history.html @@ -83,6 +83,11 @@ + + 4.21.2 + 2020-01-31 + networkConnections() fixed linux (debian) issue + 4.21.1 2020-01-31 diff --git a/docs/index.html b/docs/index.html index f4d271d..b85b05b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -168,7 +168,7 @@
systeminformation
-
Current Version: 4.21.1
+
Current Version: 4.21.2
@@ -206,7 +206,7 @@
Downloads last month
-
244
+
248
Dependends
diff --git a/lib/network.js b/lib/network.js index 0ebc31d..c0ba7da 100644 --- a/lib/network.js +++ b/lib/network.js @@ -1132,8 +1132,8 @@ function networkConnections(callback) { let cmd = 'export LC_ALL=C; netstat -tunap | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN"; unset LC_ALL'; if (_freebsd || _openbsd || _netbsd) cmd = 'export LC_ALL=C; netstat -na | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN"; unset LC_ALL'; exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { - if (!error) { - let lines = stdout.toString().split('\n'); + let lines = stdout.toString().split('\n'); + if (!error && (lines.length > 1 || lines[0] != '')) { lines.forEach(function (line) { line = line.replace(/ +/g, ' ').split(' '); if (line.length >= 7) {