Navigation Menu

Skip to content

Commit

Permalink
os/exec: make LookPath always search the current directory under Wind…
Browse files Browse the repository at this point in the history
…ows.

cmd.exe implicitly looks in "." before consulting PATH.
LookPath should match this behavior.

R=alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/5434093
  • Loading branch information
bsiegert authored and alexbrainman committed Dec 2, 2011
1 parent 517503d commit 2a876be
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/pkg/os/exec/lp_windows.go
Expand Up @@ -63,11 +63,10 @@ func LookPath(file string) (f string, err error) {
}
return ``, &Error{file, err}
}
if pathenv := os.Getenv(`PATH`); pathenv == `` {
if f, err = findExecutable(`.\`+file, exts); err == nil {
return
}
} else {
if f, err = findExecutable(`.\`+file, exts); err == nil {
return
}
if pathenv := os.Getenv(`PATH`); pathenv != `` {
for _, dir := range strings.Split(pathenv, `;`) {
if f, err = findExecutable(dir+`\`+file, exts); err == nil {
return
Expand Down

0 comments on commit 2a876be

Please sign in to comment.