networkInterfaceDefault() optimization (macOS)
This commit is contained in:
+1
-1
@@ -106,7 +106,7 @@ function getDefaultNetworkInterface() {
|
||||
if (_darwin || _freebsd || _openbsd || _netbsd || _sunos) {
|
||||
let cmd = '';
|
||||
if (_linux) cmd = 'ip route 2> /dev/null | grep default | awk \'{print $5}\'';
|
||||
if (_darwin) cmd = 'route get 0.0.0.0 2>/dev/null | grep interface: | awk \'{print $2}\'';
|
||||
if (_darwin) cmd = 'route -n get default 2>/dev/null | grep interface: | awk \'{print $2}\'';
|
||||
if (_freebsd || _openbsd || _netbsd || _sunos) cmd = 'route get 0.0.0.0 | grep interface:';
|
||||
let result = execSync(cmd);
|
||||
ifacename = result.toString().split('\n')[0];
|
||||
|
||||
Reference in New Issue
Block a user