From e6320b3e0cbb085d99e6e66750687c534d335feb Mon Sep 17 00:00:00 2001 From: Daniel Morandini Date: Fri, 12 Jul 2019 15:54:36 +0200 Subject: [PATCH] Take only base path component to build filter --- lookup/internal/filter.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lookup/internal/filter.go b/lookup/internal/filter.go index bc3880d..98bbdd8 100644 --- a/lookup/internal/filter.go +++ b/lookup/internal/filter.go @@ -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 {