currentLoad() workarround for empty os.cpus info
This commit is contained in:
+1
-1
@@ -1142,7 +1142,7 @@ function getLoad() {
|
||||
let totalIrq = 0;
|
||||
let totalIdle = 0;
|
||||
let cores = [];
|
||||
_corecount = (cpus && cpus.length) ? cpus.length : 1;
|
||||
_corecount = (cpus && cpus.length) ? cpus.length : 0;
|
||||
|
||||
for (let i = 0; i < _corecount; i++) {
|
||||
const cpu = cpus[i].times;
|
||||
|
||||
+1
-1
@@ -763,7 +763,7 @@ function networkInterfaces(callback) {
|
||||
}
|
||||
mac = details.mac;
|
||||
// fallback due to https://github.com/nodejs/node/issues/13581 (node 8.1 - node 8.2)
|
||||
if (mac.indexOf('00:00:0') > -1 && (_linux || _darwin)) {
|
||||
if (mac.indexOf('00:00:0') > -1 && (_linux || _darwin) && parseInt(process.versions.node.split('.'), 10) === 8) {
|
||||
if (Object.keys(_mac).length === 0) {
|
||||
_mac = getMacAddresses();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user