Commit a6149da0 authored by Alex Brainman's avatar Alex Brainman

os/exec: change windows LookPath so it works like cmd.exe

Fixes #6224

R=golang-dev, hcwfrichter, bradfitz
CC=golang-dev
https://golang.org/cl/13410045
parent 5d2c3a68
......@@ -24,14 +24,21 @@ func chkStat(file string) error {
return nil
}
func hasExt(file string) bool {
i := strings.LastIndex(file, ".")
if i < 0 {
return false
}
return strings.LastIndexAny(file, `:\/`) < i
}
func findExecutable(file string, exts []string) (string, error) {
if len(exts) == 0 {
return file, chkStat(file)
}
f := strings.ToLower(file)
for _, e := range exts {
if strings.HasSuffix(f, e) {
return file, chkStat(file)
if hasExt(file) {
if chkStat(file) == nil {
return file, nil
}
}
for _, e := range exts {
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment