Skip to content

Commit

Permalink
Take only base path component to build filter
Browse files Browse the repository at this point in the history
  • Loading branch information
dmorn committed Jul 12, 2019
1 parent a882142 commit e6320b3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lookup/internal/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,18 @@ func pids(proc string) []string {
// Windows helpers

func prepareNFExprWin(s string) string {
// TODO: what if "s" is a symlink?
if !strings.HasSuffix(s, ".exe") {
// we're not able to use something that is not
// an executable name.
log.Printf("\"%s\" does not lead to an .exe", s)
return s
}

// TODO: what if "s" is a path? Only its last component
// is required.
if _, err := os.Stat(s); err == nil {
// take only last path component
log.Printf("Taking only last path component of \"%s\"", s)
s = filepath.Base(s)
}

tasks := tasks(s)
if len(tasks) == 0 {
Expand Down

0 comments on commit e6320b3

Please sign in to comment.