Skip to content

Commit

Permalink
Add binary path to integration test utiltool
Browse files Browse the repository at this point in the history
  • Loading branch information
vlabo authored and dhaavi committed Apr 25, 2023
1 parent 7d3b45f commit 34e0358
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion cmds/integrationtest/netstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"github.com/safing/portmaster/network/packet"
"github.com/safing/portmaster/network/socket"
"github.com/safing/portmaster/network/state"

processInfo "github.com/shirou/gopsutil/process"
)

func init() {
Expand Down Expand Up @@ -105,7 +107,16 @@ func checkAndPrintSocketInfoIfNew(c string, s socket.Info) {

// Print result.
if err == nil {
fmt.Printf("%s %d\n", c, s.GetPID())

pInfo, err := processInfo.NewProcess(int32(s.GetPID()))

if err != nil {
fmt.Printf("%s %d no binary: %s\n", c, s.GetPID(), err)
} else {
exe, _ := pInfo.Exe()
fmt.Printf("%s %d %s\n", c, s.GetPID(), exe)
}

} else {
fmt.Printf("%s %d (err: %s)\n", c, s.GetPID(), err)
}
Expand Down

0 comments on commit 34e0358

Please sign in to comment.