diff options
Diffstat (limited to 'libgo/go/os/exec')
-rw-r--r-- | libgo/go/os/exec/lp_unix.go | 5 | ||||
-rw-r--r-- | libgo/go/os/exec/lp_windows.go | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/libgo/go/os/exec/lp_unix.go b/libgo/go/os/exec/lp_unix.go index a221137..2d3a919 100644 --- a/libgo/go/os/exec/lp_unix.go +++ b/libgo/go/os/exec/lp_unix.go @@ -47,8 +47,9 @@ func LookPath(file string) (string, error) { // Unix shell semantics: path element "" means "." dir = "." } - if err := findExecutable(dir + "/" + file); err == nil { - return dir + "/" + file, nil + path := dir + "/" + file + if err := findExecutable(path); err == nil { + return path, nil } } return "", &Error{file, ErrNotFound} diff --git a/libgo/go/os/exec/lp_windows.go b/libgo/go/os/exec/lp_windows.go index d09e839..b7efcd6 100644 --- a/libgo/go/os/exec/lp_windows.go +++ b/libgo/go/os/exec/lp_windows.go @@ -42,6 +42,11 @@ func findExecutable(file string, exts []string) (string, error) { return ``, os.ENOENT } +// LookPath searches for an executable binary named file +// in the directories named by the PATH environment variable. +// If file contains a slash, it is tried directly and the PATH is not consulted. +// LookPath also uses PATHEXT environment variable to match +// a suitable candidate. func LookPath(file string) (f string, err error) { x := os.Getenv(`PATHEXT`) if x == `` { |