| 4.17.0 |
2020-01-04 |
diff --git a/docs/index.html b/docs/index.html
index 87a1101..a135aa2 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -168,7 +168,7 @@
systeminformation
- Current Version: 4.17.0
+ Current Version: 4.17.1
diff --git a/lib/filesystem.js b/lib/filesystem.js
index 8cc47ef..18b699f 100644
--- a/lib/filesystem.js
+++ b/lib/filesystem.js
@@ -37,6 +37,34 @@ let _disk_io = {};
function fsSize(callback) {
+ function parseDf(lines) {
+ let data = [];
+ lines.forEach(function (line) {
+ if (line !== '') {
+ line = line.replace(/ +/g, ' ').split(' ');
+ if (line && (line[0].startsWith('/')) || (line[6] && line[6] === '/')) {
+ const fs = line[0];
+ const fstype = ((_linux || _freebsd || _openbsd || _netbsd) ? line[1] : 'HFS');
+ const size = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[2] : line[1])) * 1024;
+ const used = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[3] : line[2])) * 1024;
+ const use = parseFloat((100.0 * ((_linux || _freebsd || _openbsd || _netbsd) ? line[3] : line[2]) / ((_linux || _freebsd || _openbsd || _netbsd) ? line[2] : line[1])).toFixed(2));
+ const mount = line[line.length - 1];
+ if (!data.find(el => (el.fs === fs && el.type === fstype))) {
+ data.push({
+ fs,
+ type: fstype,
+ size,
+ used,
+ use,
+ mount
+ });
+ }
+ }
+ }
+ });
+ return data;
+ }
+
return new Promise((resolve) => {
process.nextTick(() => {
let data = [];
@@ -48,27 +76,23 @@ function fsSize(callback) {
exec(cmd, function (error, stdout) {
if (!error) {
let lines = stdout.toString().split('\n');
- //lines.splice(0, 1);
- lines.forEach(function (line) {
- if (line !== '') {
- line = line.replace(/ +/g, ' ').split(' ');
- if (line && (line[0].startsWith('/')) || (line[6] && line[6] === '/')) {
- data.push({
- 'fs': line[0],
- 'type': ((_linux || _freebsd || _openbsd || _netbsd) ? line[1] : 'HFS'),
- 'size': parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[2] : line[1])) * 1024,
- 'used': parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[3] : line[2])) * 1024,
- 'use': parseFloat((100.0 * ((_linux || _freebsd || _openbsd || _netbsd) ? line[3] : line[2]) / ((_linux || _freebsd || _openbsd || _netbsd) ? line[2] : line[1])).toFixed(2)),
- 'mount': line[line.length - 1]
- });
- }
+ data = parseDf(lines);
+ if (callback) {
+ callback(data);
+ }
+ resolve(data);
+ } else {
+ exec('df -kPT', function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ data = parseDf(lines);
}
+ if (callback) {
+ callback(data);
+ }
+ resolve(data);
});
}
- if (callback) {
- callback(data);
- }
- resolve(data);
});
}
if (_sunos) {
@@ -282,7 +306,7 @@ function blockDevices(callback) {
if (_linux) {
// see https://wiki.ubuntuusers.de/lsblk/
// exec("lsblk -bo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,TRAN,SERIAL,LABEL,MODEL,OWNER,GROUP,MODE,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,SCHED,RQ-SIZE,RA,WSAME", function (error, stdout) {
- exec('lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,TRAN,SERIAL,LABEL,MODEL,OWNER', function (error, stdout) {
+ exec('lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,TRAN,SERIAL,LABEL,MODEL,OWNER 2>/dev/null', function (error, stdout) {
if (!error) {
let lines = blkStdoutToObject(stdout).split('\n');
data = parseBlk(lines);
@@ -291,7 +315,7 @@ function blockDevices(callback) {
}
resolve(data);
} else {
- exec('lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,LABEL,MODEL,OWNER', function (error, stdout) {
+ exec('lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,LABEL,MODEL,OWNER 2>/dev/null', function (error, stdout) {
if (!error) {
let lines = blkStdoutToObject(stdout).split('\n');
data = parseBlk(lines);
@@ -439,7 +463,7 @@ function fsStats(callback) {
if ((_fs_speed && !_fs_speed.ms) || (_fs_speed && _fs_speed.ms && Date.now() - _fs_speed.ms >= 500)) {
if (_linux) {
// exec("df -k | grep /dev/", function(error, stdout) {
- exec('lsblk | grep /', function (error, stdout) {
+ exec('lsblk 2>/dev/null | grep /', function (error, stdout) {
if (!error) {
let lines = stdout.toString().split('\n');
let fs_filter = [];
@@ -594,7 +618,7 @@ function disksIO(callback) {
// prints Block layer statistics for all mounted volumes
// var cmd = "for mount in `lsblk | grep / | sed -r 's/│ └─//' | cut -d ' ' -f 1`; do cat /sys/block/$mount/stat | sed -r 's/ +/;/g' | sed -r 's/^;//'; done";
// var cmd = "for mount in `lsblk | grep / | sed 's/[│└─├]//g' | awk '{$1=$1};1' | cut -d ' ' -f 1 | sort -u`; do cat /sys/block/$mount/stat | sed -r 's/ +/;/g' | sed -r 's/^;//'; done";
- let cmd = 'for mount in `lsblk | grep " disk " | sed "s/[│└─├]//g" | awk \'{$1=$1};1\' | cut -d " " -f 1 | sort -u`; do cat /sys/block/$mount/stat | sed -r "s/ +/;/g" | sed -r "s/^;//"; done';
+ let cmd = 'for mount in `lsblk 2>/dev/null | grep " disk " | sed "s/[│└─├]//g" | awk \'{$1=$1};1\' | cut -d " " -f 1 | sort -u`; do cat /sys/block/$mount/stat | sed -r "s/ +/;/g" | sed -r "s/^;//"; done';
exec(cmd, function (error, stdout) {
if (!error) {
@@ -713,7 +737,7 @@ function diskLayout(callback) {
let cmd = '';
if (_linux) {
- exec('export LC_ALL=C; lsblk -ablJO; unset LC_ALL', function (error, stdout) {
+ exec('export LC_ALL=C; lsblk -ablJO 2>/dev/null; unset LC_ALL', function (error, stdout) {
if (!error) {
try {
const out = stdout.toString().trim();
@@ -725,7 +749,7 @@ function diskLayout(callback) {
}
} 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; unset LC_ALL').toString();
+ 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 !== ''; });
diff --git a/lib/network.js b/lib/network.js
index a708b92..a697e4b 100644
--- a/lib/network.js
+++ b/lib/network.js
@@ -474,7 +474,7 @@ function getDarwinNics() {
function getLinuxIfaceConnectionName(interfaceName) {
- const cmd = `nmcli device status | grep ${interfaceName}`;
+ const cmd = `nmcli device status 2>/dev/null | grep ${interfaceName}`;
try {
const result = execSync(cmd).toString();
@@ -490,7 +490,7 @@ function getLinuxIfaceConnectionName(interfaceName) {
function getLinuxIfaceDHCPstatus(connectionName) {
let result = false;
if (connectionName) {
- const cmd = `nmcli connection show "${connectionName}" \| grep ipv4.method;`;
+ const cmd = `nmcli connection show "${connectionName}" 2>/dev/null \| grep ipv4.method;`;
try {
const result = execSync(cmd).toString();
const resultFormat = result.replace(/\s+/g, ' ').trim();
@@ -516,7 +516,7 @@ function getLinuxIfaceDHCPstatus(connectionName) {
function getLinuxIfaceDNSsuffix(connectionName) {
if (connectionName) {
- const cmd = `nmcli connection show "${connectionName}" \| grep ipv4.dns-search;`;
+ const cmd = `nmcli connection show "${connectionName}" 2>/dev/null \| grep ipv4.dns-search;`;
try {
const result = execSync(cmd).toString();
const resultFormat = result.replace(/\s+/g, ' ').trim();
@@ -532,7 +532,7 @@ function getLinuxIfaceDNSsuffix(connectionName) {
function getLinuxIfaceIEEE8021xAuth(connectionName) {
if (connectionName) {
- const cmd = `nmcli connection show "${connectionName}" \| grep 802-1x.eap;`;
+ const cmd = `nmcli connection show "${connectionName}" 2>/dev/null \| grep 802-1x.eap;`;
try {
const result = execSync(cmd).toString();
const resultFormat = result.replace(/\s+/g, ' ').trim();
diff --git a/lib/osinfo.js b/lib/osinfo.js
index b7cb47f..6049a31 100644
--- a/lib/osinfo.js
+++ b/lib/osinfo.js
@@ -155,7 +155,7 @@ function getLogoFile(distro) {
else if (distro.indexOf('robolinux') !== -1) {
result = 'robolinux';
} else if (_linux && distro) {
- result = distro.toLowerCase();
+ result = distro.toLowerCase().trim().replace(/\s+/g, '-');
}
return result;
}
diff --git a/lib/wifi.js b/lib/wifi.js
index 44f895a..bbb57ae 100644
--- a/lib/wifi.js
+++ b/lib/wifi.js
@@ -117,7 +117,7 @@ function wifiNetworks(callback) {
process.nextTick(() => {
let result = [];
if (_linux) {
- let cmd = 'nmcli --terse --fields active,ssid,bssid,mode,chan,freq,signal,security,wpa-flags,rsn-flags device wifi list';
+ let cmd = 'nmcli --terse --fields active,ssid,bssid,mode,chan,freq,signal,security,wpa-flags,rsn-flags device wifi list 2>/dev/null';
exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
const parts = stdout.toString().split('ACTIVE:');