Skip to content

Commit

Permalink
pkg/tool/exec: Run does not exececute shell commands
Browse files Browse the repository at this point in the history
It has always been an abstraction over os/exec.Command, that is,
directly calling a program with some arguments and not a shell.
The top-level godoc was misleading users into thinking
they could use shell syntax like pipes or redirections.

While here, make the cmd docs a bit clearer as well.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: I8daa362deac7cb5380f39511f60908c9f13627b9
Dispatch-Trailer: {"type":"trybot","CL":1200524,"patchset":1,"ref":"refs/changes/24/1200524/1","targetBranch":"master"}
  • Loading branch information
mvdan authored and cueckoo committed Sep 2, 2024
1 parent 1440b9e commit 8989c3f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions pkg/tool/exec/exec.cue
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@

package exec

// Run executes the given shell command.
// Run executes a program with the given arguments.
Run: {
$id: *"tool/exec.Run" | "exec" // exec for backwards compatibility

// cmd is the command to run.
// cmd is a non-empty list holding the program name to run
// and the arguments to be passed to it.
//
// Simple commands can use a string, which is split by white space characters.
// If any arguments include white space, use the list form.
// If any arguments include white space, or for clarity, use the list form.
cmd: string | [string, ...string]

// dir specifies the working directory of the command.
Expand Down
8 changes: 5 additions & 3 deletions pkg/tool/exec/pkg.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8989c3f

Please sign in to comment.