From 7a8ed92cd08919dd8bda44a1bf23e01cc6832452 Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Fri, 2 Sep 2016 13:16:43 +0200 Subject: [PATCH] tiny fixes system.model, getDefaultNetworkInterface --- README.md | 3 ++- lib/index.js | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 23dae88..5619b46 100644 --- a/README.md +++ b/README.md @@ -377,7 +377,8 @@ I am happy to discuss any comments and suggestions. Please feel free to contact | Version | Date | Comment | | -------------- | -------------- | -------- | -| 3.4.3 | 2016-09-02 | tiny bug fix fsStats, DisksIO OSX | +| 3.4.4 | 2016-09-02 | tiny fixes system.model, getDefaultNetworkInterface | +| 3.4.3 | 2016-09-02 | tiny bug fix fsStats, disksIO OSX | | 3.4.2 | 2016-09-01 | improved default network interface | | 3.4.1 | 2016-08-30 | updated docs | | 3.4.0 | 2016-08-30 | rewritten processes current cpu usage | diff --git a/lib/index.js b/lib/index.js index 9787302..a4675ae 100644 --- a/lib/index.js +++ b/lib/index.js @@ -80,7 +80,8 @@ // -------------------------------- // // version date comment -// 3.4.3 2016-09-02 tiny bug fix fsStats, DisksIO OSX +// 3.4.4 2016-09-02 tiny fixes system.model, getDefaultNetworkInterface +// 3.4.3 2016-09-02 tiny bug fix fsStats, disksIO OSX // 3.4.2 2016-09-01 improved default network interface // 3.4.1 2016-08-30 updated docs // 3.4.0 2016-08-30 rewritten current process cpu usage (linux) @@ -198,8 +199,11 @@ function system(callback) { } }); if (result.serial.toLowerCase().indexOf('o.e.m.') != -1) result.serial = '-'; + if (result.manufacturer.toLowerCase().indexOf('o.e.m.') != -1) result.manufacturer = ''; + if (result.model.toLowerCase().indexOf('o.e.m.') != -1) result.model = 'Computer'; + if (result.version.toLowerCase().indexOf('o.e.m.') != -1) result.version = '-'; - if (result.manufacturer == '-' && result.model == '-' && result.version == '-') { + if (result.manufacturer == '' && result.model == 'Computer' && result.version == '-') { // Check Raspberry Pi exec("grep Hardware /proc/cpuinfo; grep Serial /proc/cpuinfo; grep Revision /proc/cpuinfo", function (error, stdout) { if (!error) { @@ -1168,7 +1172,7 @@ exports.disksIO = disksIO; function getDefaultNetworkInterface() { let ifacename = ''; - let cmd = (_linux ? "route | grep default | awk '{print $8}'" : "route get 0.0.0.0 2>/dev/null | grep interface: | awk '{print $2}'"); + let cmd = (_linux ? "route 2>/dev/null | grep default | awk '{print $8}'" : "route get 0.0.0.0 2>/dev/null | grep interface: | awk '{print $2}'"); let result = execSync(cmd); ifacename = result.toString().split('\n')[0];