Skip to content

Commit

Permalink
FindHelperBinary will try LookPath of absolute path
Browse files Browse the repository at this point in the history
exec.LookPath seems to handle absolute paths requested. On Windows this
allows to additionally check for all known executable alternatives
when only name is provided.

Signed-off-by: Arthur Sengileyev <[email protected]>
  • Loading branch information
arixmkii committed Jan 11, 2023
1 parent 6d9b89b commit e90ecd2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,12 @@ func (c *Config) FindHelperBinary(name string, searchPATH bool) (string, error)
if fi, err := os.Stat(fullpath); err == nil && fi.Mode().IsRegular() {
return fullpath, nil
}
abspath, err := filepath.Abs(fullpath)
if err == nil {
if lp, err := exec.LookPath(abspath); err == nil {
return lp, nil
}
}
}
if searchPATH {
return exec.LookPath(name)
Expand Down

0 comments on commit e90ecd2

Please sign in to comment.