Commit bfac91a6 authored by Michael Hoisie's avatar Michael Hoisie Committed by Russ Cox

exec.LookPath: return os.PathError instad of os.ENOENT, it's more descriptive.

R=rsc
CC=golang-dev
https://golang.org/cl/3448042
parent 688a8312
......@@ -29,7 +29,7 @@ func LookPath(file string) (string, os.Error) {
if canExec(file) {
return file, nil
}
return "", os.ENOENT
return "", &os.PathError{"lookpath", file, os.ENOENT}
}
pathenv := os.Getenv("PATH")
for _, dir := range strings.Split(pathenv, ":", -1) {
......@@ -41,5 +41,5 @@ func LookPath(file string) (string, os.Error) {
return dir + "/" + file, nil
}
}
return "", os.ENOENT
return "", &os.PathError{"lookpath", file, os.ENOENT}
}
......@@ -49,7 +49,7 @@ func LookPath(file string) (string, os.Error) {
if f, ok := canExec(file, exts); ok {
return f, nil
}
return ``, os.ENOENT
return ``, &os.PathError{"lookpath", file, os.ENOENT}
}
if pathenv := os.Getenv(`PATH`); pathenv == `` {
if f, ok := canExec(`.\`+file, exts); ok {
......@@ -62,5 +62,5 @@ func LookPath(file string) (string, os.Error) {
}
}
}
return ``, os.ENOENT
return ``, &os.PathError{"lookpath", file, os.ENOENT}
}
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