mirror of
https://github.com/tailscale/tailscale.git
synced 2025-03-29 20:42:22 +00:00
portlist: fix tests on Windows when not running as Administrator
Updates #50
This commit is contained in:
parent
7ac91c15bd
commit
4a92fc9dc5
@ -8,6 +8,7 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"golang.org/x/sys/windows"
|
||||||
exec "tailscale.com/tempfork/osexec"
|
exec "tailscale.com/tempfork/osexec"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -19,6 +20,9 @@ func listPorts() (List, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func addProcesses(pl []Port) ([]Port, error) {
|
func addProcesses(pl []Port) ([]Port, error) {
|
||||||
|
if t := windows.GetCurrentProcessToken(); !t.IsElevated() {
|
||||||
|
return listPortsNetstat("-na")
|
||||||
|
}
|
||||||
return listPortsNetstat("-nab")
|
return listPortsNetstat("-nab")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user