]> Cypherpunks repositories - gostls13.git/commitdiff
exec.LookPath: return os.PathError instad of os.ENOENT, it's more descriptive.
authorMichael Hoisie <hoisie@gmail.com>
Tue, 7 Dec 2010 20:57:00 +0000 (15:57 -0500)
committerRuss Cox <rsc@golang.org>
Tue, 7 Dec 2010 20:57:00 +0000 (15:57 -0500)
R=rsc
CC=golang-dev
https://golang.org/cl/3448042

src/pkg/exec/lp_unix.go
src/pkg/exec/lp_windows.go

index b2feecd10e1479963808dea4cbea91303666d53b..292e24fccddd20b3efeb843392de59506c39a210 100644 (file)
@@ -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}
 }
index 9d5dc1a1441672b3afd80ad2ef3a646870e19add..7b56afa85664fc40ad76e38ae09fd7258db9843e 100644 (file)
@@ -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}
 }