Skip to content

Commit

Permalink
Remove " (deleted)" suffix on linux for deleted files
Browse files Browse the repository at this point in the history
  • Loading branch information
dhaavi committed Jun 3, 2020
1 parent 328884c commit bbafef2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"path/filepath"
"runtime"
"strings"
"sync"
"time"

Expand All @@ -15,6 +16,10 @@ import (
"github.com/safing/portmaster/profile"
)

const (
onLinux = runtime.GOOS == "linux"
)

var (
dupReqMap = make(map[int]*sync.WaitGroup)
dupReqLock sync.Mutex
Expand Down Expand Up @@ -263,6 +268,10 @@ func loadProcess(ctx context.Context, pid int) (*Process, error) {
if err != nil {
return nil, fmt.Errorf("failed to get Path for p%d: %s", pid, err)
}
// remove linux " (deleted)" suffix for deleted files
if onLinux {
new.Path = strings.TrimSuffix(new.Path, " (deleted)")
}
// Executable Name
_, new.ExecName = filepath.Split(new.Path)

Expand Down

0 comments on commit bbafef2

Please sign in to comment.