mirror of
https://github.com/golang/go
synced 2024-11-20 09:04:44 -07:00
exec.LookPath: return os.PathError instad of os.ENOENT, it's more descriptive.
R=rsc CC=golang-dev https://golang.org/cl/3448042
This commit is contained in:
parent
688a83128d
commit
bfac91a6b9
@ -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}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user