You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This unifies these similar methods into a single method. The interface
is additionally changed to:
- Accepts a `Context` argument.
- Allow for defaults and named arguments, using an `ExecOptions` struct
that is passed as an argument.
- Allow configuring command output handling in a flexible way. Instead
of passing bools for some specific configurations, you can now pass
either `Ignore`, `Show` or `Capture` for both stdout and stderr
independently.
By default, stdout is is shown when verbose is true, or ignored when
verbose is false. Stderr is shown by default.
- Actually redirect stdout to `/dev/null` when it is not needed (by
leaving `command.Stdout` at nil). Previously, `ExecRecipe` would
either show or capture stdout, and the captured output was usually
just thrown away.
To allow for even more reuse, the biggest part of `ExecRecipe` is
extracted into a new `utils.ExecCommand()` function which executes an
arbitrary `exec.Cmd` object, with configurable output redirection.
Signed-off-by: Matthijs Kooijman <[email protected]>
0 commit comments