Skip to content

Commit

Permalink
Don't error each time ip link has no wifi
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Dec 15, 2021
1 parent 6f899e5 commit 92ea896
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/status/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ func (n *network) wirelessName() (string, error) {

func (n *network) isEthernetConnected() (bool, error) {
if ip, _ := exec.LookPath("ip"); ip != "" {
out, err := exec.Command("bash", []string{"-c", "ip link | grep \",UP,\" | grep -v LOOPBACK | grep -v \": wl\""}...).Output()
out, err := exec.Command("bash", []string{"-c", "ip link | grep \",UP,\" | grep -v LOOPBACK | grep -v \": wl\" | wc -l"}...).Output()
if err != nil {
log.Println("Error running ip tool", err)
return false, err
}
if strings.TrimSpace(string(out)) == "" {
if strings.TrimSpace(string(out)) == "0" {
return false, nil
}
} else {
Expand Down

0 comments on commit 92ea896

Please sign in to comment.