portlist: fix tests on Windows when not running as Administrator

Updates #50
reviewable/pr867/r1
Brad Fitzpatrick 4 years ago
parent 7ac91c15bd
commit 4a92fc9dc5

@ -8,6 +8,7 @@ import (
"syscall"
"time"
"golang.org/x/sys/windows"
exec "tailscale.com/tempfork/osexec"
)
@ -19,6 +20,9 @@ func listPorts() (List, error) {
}
func addProcesses(pl []Port) ([]Port, error) {
if t := windows.GetCurrentProcessToken(); !t.IsElevated() {
return listPortsNetstat("-na")
}
return listPortsNetstat("-nab")
}

Loading…
Cancel
Save