]> Cypherpunks repositories - gostls13.git/commitdiff
os/exec: remove "binary" when talking about executables
authorTim Cooper <tim.cooper@layeh.com>
Sat, 27 Jan 2018 02:29:55 +0000 (22:29 -0400)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 17 Apr 2018 05:05:45 +0000 (05:05 +0000)
The use of binary was incorrect as executable files can also be scripts.

The docs for Error are also reworded. The old docs implied that Error was
returned when attempting to start an executable, which is not correct: it
was returned by LookPath when the file was not found or did not have the
attributes of an executable.

Change-Id: I757a44b16612936df4498b43c45c12e4c14956d2
Reviewed-on: https://go-review.googlesource.com/90315
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/os/exec/exec.go
src/os/exec/exec_test.go
src/os/exec/lp_plan9.go
src/os/exec/lp_unix.go
src/os/exec/lp_windows.go

index 5ef9540141ef0e7bba36b6b97bc3e1c7de81b92c..41fbf963708cb26572472692b8f755a0bd380e0e 100644 (file)
@@ -34,11 +34,13 @@ import (
        "syscall"
 )
 
-// Error records the name of a binary that failed to be executed
-// and the reason it failed.
+// Error is returned by LookPath when it fails to classify a file as an
+// executable.
 type Error struct {
+       // Name is the file name for which the error occurred.
        Name string
-       Err  error
+       // Err is the underlying error.
+       Err error
 }
 
 func (e *Error) Error() string {
index 61ffcafcd5e67bb0b00867d2be9da4aa76c32676..7bb230806f95ad853fa6d0fc06d84484949ec39d 100644 (file)
@@ -142,11 +142,11 @@ func TestCatGoodAndBadFile(t *testing.T) {
        }
 }
 
-func TestNoExistBinary(t *testing.T) {
-       // Can't run a non-existent binary
-       err := exec.Command("/no-exist-binary").Run()
+func TestNoExistExecutable(t *testing.T) {
+       // Can't run a non-existent executable
+       err := exec.Command("/no-exist-executable").Run()
        if err == nil {
-               t.Error("expected error from /no-exist-binary")
+               t.Error("expected error from /no-exist-executable")
        }
 }
 
@@ -334,7 +334,7 @@ func TestPipeLookPathLeak(t *testing.T) {
        }
 
        for i := 0; i < 6; i++ {
-               cmd := exec.Command("something-that-does-not-exist-binary")
+               cmd := exec.Command("something-that-does-not-exist-executable")
                cmd.StdoutPipe()
                cmd.StderrPipe()
                cmd.StdinPipe()
index 142f87ed32b3b52e26e518ca8645494304fd5d15..5860cbca4d32f676ff122fc3d14fa540ffbdb153 100644 (file)
@@ -25,8 +25,8 @@ func findExecutable(file string) error {
        return os.ErrPermission
 }
 
-// LookPath searches for an executable binary named file
-// in the directories named by the path environment variable.
+// LookPath searches for an executable named file in the
+// directories named by the path environment variable.
 // If file begins with "/", "#", "./", or "../", it is tried
 // directly and the path is not consulted.
 // The result may be an absolute path or a path relative to the current directory.
index 7a302752a8974dc04e16d937d96b65e6b8c02575..e098ff8e1d5b740d4ccb3f8bb6206d271bcd6921 100644 (file)
@@ -27,8 +27,8 @@ func findExecutable(file string) error {
        return os.ErrPermission
 }
 
-// LookPath searches for an executable binary named file
-// in the directories named by the PATH environment variable.
+// LookPath searches for an executable named file in the
+// directories named by the PATH environment variable.
 // If file contains a slash, it is tried directly and the PATH is not consulted.
 // The result may be an absolute path or a path relative to the current directory.
 func LookPath(file string) (string, error) {
index 793d4d98b3a6aef429196c9f4a5186af131944ae..9ea3d765757b6411cc4f99d7a2dd4fa56e1ef340 100644 (file)
@@ -50,8 +50,8 @@ func findExecutable(file string, exts []string) (string, error) {
        return "", os.ErrNotExist
 }
 
-// LookPath searches for an executable binary named file
-// in the directories named by the PATH environment variable.
+// LookPath searches for an executable named file in the
+// directories named by the PATH environment variable.
 // If file contains a slash, it is tried directly and the PATH is not consulted.
 // LookPath also uses PATHEXT environment variable to match
 // a suitable candidate.