From: Michael Hoisie Date: Tue, 7 Dec 2010 20:57:00 +0000 (-0500) Subject: exec.LookPath: return os.PathError instad of os.ENOENT, it's more descriptive. X-Git-Tag: weekly.2010-12-08~15 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=bfac91a6b9aee3bc19e8ab0fb0da0e754b53ffa2;p=gostls13.git exec.LookPath: return os.PathError instad of os.ENOENT, it's more descriptive. R=rsc CC=golang-dev https://golang.org/cl/3448042 --- diff --git a/src/pkg/exec/lp_unix.go b/src/pkg/exec/lp_unix.go index b2feecd10e..292e24fccd 100644 --- a/src/pkg/exec/lp_unix.go +++ b/src/pkg/exec/lp_unix.go @@ -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} } diff --git a/src/pkg/exec/lp_windows.go b/src/pkg/exec/lp_windows.go index 9d5dc1a144..7b56afa856 100644 --- a/src/pkg/exec/lp_windows.go +++ b/src/pkg/exec/lp_windows.go @@ -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} }