diff options
author | Quentin Smith <quentin@golang.org> | 2016-10-21 16:34:40 -0400 |
---|---|---|
committer | Quentin Smith <quentin@golang.org> | 2016-10-28 19:18:29 +0000 |
commit | bd8103d50b5e576610709738d9e3138ae7887c28 (patch) | |
tree | 1e51ff5877b3326c4c8f169c6bd884206699651c /src/os/exec/exec.go | |
parent | 88518e7dd6a118167aa71851a3a9f24d0230bc82 (diff) | |
download | go-bd8103d50b5e576610709738d9e3138ae7887c28.tar.gz go-bd8103d50b5e576610709738d9e3138ae7887c28.zip |
os/exec: document how Command fills in Cmd.Args
Fixes #17536
Change-Id: Ica8c3d696848822ac65b7931455b1fd94809bfe8
Reviewed-on: https://go-review.googlesource.com/31710
Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/os/exec/exec.go')
-rw-r--r-- | src/os/exec/exec.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/os/exec/exec.go b/src/os/exec/exec.go index 234b3bda5f..a3a0f20ebc 100644 --- a/src/os/exec/exec.go +++ b/src/os/exec/exec.go @@ -120,12 +120,13 @@ type Cmd struct { // It sets only the Path and Args in the returned structure. // // If name contains no path separators, Command uses LookPath to -// resolve the path to a complete name if possible. Otherwise it uses -// name directly. +// resolve name to a complete path if possible. Otherwise it uses name +// directly as Path. // // The returned Cmd's Args field is constructed from the command name // followed by the elements of arg, so arg should not include the -// command name itself. For example, Command("echo", "hello") +// command name itself. For example, Command("echo", "hello"). +// Args[0] is always name, not the possibly resolved Path. func Command(name string, arg ...string) *Cmd { cmd := &Cmd{ Path: name, |