From 8989c3f05db7fb6034bc8e2aaa5d0dbe3b8db1a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Mon, 2 Sep 2024 16:50:09 +0100 Subject: [PATCH] pkg/tool/exec: Run does not exececute shell commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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í Change-Id: I8daa362deac7cb5380f39511f60908c9f13627b9 Dispatch-Trailer: {"type":"trybot","CL":1200524,"patchset":1,"ref":"refs/changes/24/1200524/1","targetBranch":"master"} --- pkg/tool/exec/exec.cue | 8 +++++--- pkg/tool/exec/pkg.go | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pkg/tool/exec/exec.cue b/pkg/tool/exec/exec.cue index ee77df3a8..a4485c8ba 100644 --- a/pkg/tool/exec/exec.cue +++ b/pkg/tool/exec/exec.cue @@ -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. diff --git a/pkg/tool/exec/pkg.go b/pkg/tool/exec/pkg.go index c8c968dd0..fbe3062fb 100644 --- a/pkg/tool/exec/pkg.go +++ b/pkg/tool/exec/pkg.go @@ -4,13 +4,15 @@ // // These are the supported tasks: // -// // 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.