networkInterfaces() operstate fix (mac OS)
This commit is contained in:
+3
-1
@@ -494,7 +494,9 @@ function parseLinesDarwinNics(sections) {
|
||||
}
|
||||
}
|
||||
nic.type = util.getValue(section, 'type').toLowerCase().indexOf('wi-fi') > -1 ? 'wireless' : 'wired';
|
||||
nic.operstate = util.getValue(section, 'status').toLowerCase().indexOf('active') > -1 ? 'up' : 'down';
|
||||
const operstate = util.getValue(section, 'status').toLowerCase();
|
||||
nic.operstate = (operstate === 'active' ? 'up' : (operstate === 'inactive' ? 'down' : 'unknown'));
|
||||
// nic.operstate = util.getValue(section, 'status').toLowerCase().indexOf('active') > -1 ? 'up' : 'down';
|
||||
nic.duplex = util.getValue(section, 'media').toLowerCase().indexOf('half-duplex') > -1 ? 'half' : 'full';
|
||||
if (nic.ip6 || nic.ip4 || nic.mac) {
|
||||
nics.push(nic);
|
||||
|
||||
Reference in New Issue
Block a user