From d016e87eb81db12430644b3496a9cbfbb2b26b55 Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Mon, 7 Jan 2019 14:53:08 +0100 Subject: [PATCH] bugfix console.logs --- lib/cpu.js | 8 ++++---- lib/graphics.js | 2 +- lib/memory.js | 4 ++-- lib/system.js | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/cpu.js b/lib/cpu.js index 3c9f656..f48e0e5 100644 --- a/lib/cpu.js +++ b/lib/cpu.js @@ -348,7 +348,7 @@ function getCpu() { // socket type try { lines = []; - lines = execSync('dmidecode –t 4 | grep "Upgrade: Socket"').toString().split('\n'); + lines = execSync('dmidecode –t 4 2>/dev/null | grep "Upgrade: Socket"').toString().split('\n'); if (lines && lines.length) { result.socket = util.getValue(lines, 'Upgrade').replace('Socket', '').trim(); } @@ -362,7 +362,7 @@ function getCpu() { let modelline = ''; let lines = []; if (os.cpus()[0] && os.cpus()[0].model) modelline = os.cpus()[0].model; - exec('export LC_ALL=C; dmidecode -t 4; dmidecode -t 7 ; unset LC_ALL', function (error, stdout) { + exec('export LC_ALL=C; dmidecode -t 4 2>/dev/null; dmidecode -t 7 2>/dev/null; unset LC_ALL', function (error, stdout) { let cache = []; if (!error) { const data = stdout.toString().split('# dmidecode'); @@ -789,7 +789,7 @@ function cpuFlags(callback) { }); } if (_freebsd || _openbsd) { - exec('export LC_ALL=C; dmidecode -t 4; unset LC_ALL', function (error, stdout) { + exec('export LC_ALL=C; dmidecode -t 4 2>/dev/null; unset LC_ALL', function (error, stdout) { let flags = []; if (!error) { let parts = stdout.toString().split('\tFlags:'); @@ -867,7 +867,7 @@ function cpuCache(callback) { }); } if (_freebsd || _openbsd) { - exec('export LC_ALL=C; dmidecode -t 7 ; unset LC_ALL', function (error, stdout) { + exec('export LC_ALL=C; dmidecode -t 7 2>/dev/null; unset LC_ALL', function (error, stdout) { let cache = []; if (!error) { const data = stdout.toString(); diff --git a/lib/graphics.js b/lib/graphics.js index 729a063..dc0810d 100644 --- a/lib/graphics.js +++ b/lib/graphics.js @@ -167,7 +167,7 @@ function graphics(callback) { // PCI bus IDs let pciIDs = []; try { - pciIDs = execSync('dmidecode -t 9 | grep "Bus Address: "').toString().split('\n'); + pciIDs = execSync('dmidecode -t 9 2>/dev/null | grep "Bus Address: "').toString().split('\n'); for (let i = 0; i < pciIDs.length; i++) { pciIDs[i] = pciIDs[i].replace('Bus Address:', '').replace('0000:', '').trim(); } diff --git a/lib/memory.js b/lib/memory.js index 28bc291..7171669 100644 --- a/lib/memory.js +++ b/lib/memory.js @@ -90,7 +90,7 @@ const OSX_RAM_manufacturers = { // Reference: http://www.software-architect.net/blog/article/date/2015/06/12/-826c6e5052.html // /procs/meminfo - sample (all in kB) -// +// // MemTotal: 32806380 kB // MemFree: 19220948 kB // MemAvailable: 20851100 kB @@ -261,7 +261,7 @@ function memLayout(callback) { let result = []; if (_linux || _freebsd || _openbsd) { - exec('export LC_ALL=C; dmidecode -t memory | grep -iE "Size:|Type|Speed|Manufacturer|Form Factor|Locator|Memory Device|Serial Number|Voltage|Part Number"; unset LC_ALL', function (error, stdout) { + exec('export LC_ALL=C; dmidecode -t memory 2>/dev/null | grep -iE "Size:|Type|Speed|Manufacturer|Form Factor|Locator|Memory Device|Serial Number|Voltage|Part Number"; unset LC_ALL', function (error, stdout) { if (!error) { let devices = stdout.toString().split('Memory Device'); devices.shift(); diff --git a/lib/system.js b/lib/system.js index ea103bc..c91b8f4 100644 --- a/lib/system.js +++ b/lib/system.js @@ -40,7 +40,7 @@ function system(callback) { }; if (_linux || _freebsd || _openbsd) { - exec('dmidecode -t system', function (error, stdout) { + exec('dmidecode -t system 2>/dev/null', function (error, stdout) { if (!error) { let lines = stdout.toString().split('\n'); result.manufacturer = util.getValue(lines, 'manufacturer'); @@ -234,7 +234,7 @@ function bios(callback) { cmd = 'cat /proc/cpuinfo | grep Serial'; } else { - cmd = 'dmidecode --type 0'; + cmd = 'dmidecode --type 0 2>/dev/null'; } exec(cmd, function (error, stdout) { if (!error) { @@ -318,7 +318,7 @@ function baseboard(callback) { cmd = 'cat /proc/cpuinfo | grep Serial'; // 'BCM2709', 'BCM2835', 'BCM2708' --> } else { - cmd = 'dmidecode -t 2'; + cmd = 'dmidecode -t 2 2>/dev/null'; } exec(cmd, function (error, stdout) { if (!error) {