diff options
author | Brad Fitzpatrick <bradfitz@golang.org> | 2017-07-05 23:05:42 +0000 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@golang.org> | 2017-07-06 03:38:37 +0000 |
commit | e335643864d6ba2cba00c9f667dee742c340f02f (patch) | |
tree | 7f10f969c70f43d5aaacebe59579e9c02ac26a6e /src/os/exec/exec.go | |
parent | e71285c4c3d9cf5a3b62879327750793b0282b6f (diff) | |
download | go-e335643864d6ba2cba00c9f667dee742c340f02f.tar.gz go-e335643864d6ba2cba00c9f667dee742c340f02f.zip |
os/exec: document lack of implicit shell usage or globbing
Fixes #20894
Change-Id: I0c0e906964bbd789317d07f245e64e3d61ecfa8c
Reviewed-on: https://go-review.googlesource.com/47550
Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/os/exec/exec.go')
-rw-r--r-- | src/os/exec/exec.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/os/exec/exec.go b/src/os/exec/exec.go index 7f0d68b071..c3599681c3 100644 --- a/src/os/exec/exec.go +++ b/src/os/exec/exec.go @@ -6,6 +6,15 @@ // easier to remap stdin and stdout, connect I/O with pipes, and do other // adjustments. // +// Unlike the "system" library call from C and other languages, the +// os/exec package intentionally does not invoke the system shell and +// does not expand any glob patterns or handle other expansions, +// pipelines, or redirections typically done by shells. The package +// behaves more like C's "exec" family of functions. To expand glob +// patterns, either call the shell directly, taking care to escape any +// dangerous input, or use the path/filepath package's Glob function. +// To expand environment variables, use package os's ExpandEnv. +// // Note that the examples in this package assume a Unix system. // They may not run on Windows, and they do not run in the Go Playground // used by golang.org and godoc.org. |