Skip to content

Commit

Permalink
Incorporate review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
angrycub committed Jan 23, 2020
1 parent 72bc527 commit cc581bb
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions route_info_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,18 @@ func NewRouteInfo() (routeInfo, error) {
// GetDefaultInterfaceName returns the interface name attached to the default
// route on the default interface.
func (ri routeInfo) GetDefaultInterfaceName() (string, error) {
if hasPowershell() {
ifNameOut, err := exec.Command(cmds["defaultInterface"][0], cmds["defaultInterface"][1:]...).Output()
if err != nil {
return "", err
}
ifName := strings.TrimSpace(string(ifNameOut[:]))
return ifName, nil
} else {
if !hasPowershell() {
// No powershell, fallback to legacy method
return ri.GetDefaultInterfaceNameLegacy()
}

ifNameOut, err := exec.Command(cmds["defaultInterface"][0], cmds["defaultInterface"][1:]...).Output()
if err != nil {
return "", err
}

ifName := strings.TrimSpace(string(ifNameOut[:]))
return ifName, nil
}

// GetDefaultInterfaceNameLegacy provides legacy behavior for GetDefaultInterfaceName
Expand Down

0 comments on commit cc581bb

Please sign in to comment.