cmd/cli: only emit error for running interfaces

While at it, also ensure setDNS/resetDNS return a wrapped error on
Darwin/Windows, so the caller can decide whether to print the error to
users.
This commit is contained in:
Cuong Manh Le
2024-02-13 18:11:53 +07:00
committed by Cuong Manh Le
parent 5145729ab1
commit fdb82f6ec3
4 changed files with 23 additions and 14 deletions
+5
View File
@@ -2223,3 +2223,8 @@ func absHomeDir(filename string) string {
}
return filepath.Join(dir, filename)
}
// ifaceUp reports whether the net interface is up.
func ifaceUp(iface *net.Interface) bool {
return iface != nil && iface.Flags&net.FlagUp != 0
}