mirror of
https://github.com/golang/go
synced 2024-11-20 01:14:40 -07:00
os/exec: make LookPath always search the current directory under Windows.
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
This commit is contained in:
parent
517503dab8
commit
2a876beb18
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user