Skip to content

Commit a41a5bb

Browse files
committed
os/exec: document that LookPath's result may be a relative path
Fixes #3622 R=golang-dev, alex.brainman CC=golang-dev https://golang.org/cl/12971043
1 parent 15e6ce2 commit a41a5bb

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

src/pkg/os/exec/lp_plan9.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ func findExecutable(file string) error {
2828
// in the directories named by the path environment variable.
2929
// If file begins with "/", "#", "./", or "../", it is tried
3030
// directly and the path is not consulted.
31+
// The result may be an absolute path or a path relative to the current directory.
3132
func LookPath(file string) (string, error) {
3233
// skip the path lookup for these prefixes
3334
skip := []string{"/", "#", "./", "../"}

src/pkg/os/exec/lp_unix.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ func findExecutable(file string) error {
2929
// LookPath searches for an executable binary named file
3030
// in the directories named by the PATH environment variable.
3131
// If file contains a slash, it is tried directly and the PATH is not consulted.
32+
// The result may be an absolute path or a path relative to the current directory.
3233
func LookPath(file string) (string, error) {
3334
// NOTE(rsc): I wish we could use the Plan 9 behavior here
3435
// (only bypass the path if file begins with / or ./ or ../)

src/pkg/os/exec/lp_windows.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ func findExecutable(file string, exts []string) (string, error) {
4747
// If file contains a slash, it is tried directly and the PATH is not consulted.
4848
// LookPath also uses PATHEXT environment variable to match
4949
// a suitable candidate.
50+
// The result may be an absolute path or a path relative to the current directory.
5051
func LookPath(file string) (f string, err error) {
5152
x := os.Getenv(`PATHEXT`)
5253
if x == `` {

0 commit comments

Comments
 (0)