Documentation
¶
Overview ¶
Package executil contains some common wrappers for simple use of exec.Cmd.
Index ¶
- func CombinedOutput(c *exec.Cmd) (string, error)
- func Dir(dir, name string, args ...string) *exec.Cmd
- func MakeWorkDir(rootDir string) (string, error)
- func Output(c *exec.Cmd) (string, error)
- func Run(c *exec.Cmd) error
- func RunQuiet(c *exec.Cmd) error
- func SpaceTrimmedCombinedOutput(c *exec.Cmd) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CombinedOutput ¶
CombinedOutput runs a command and returns the output string of c.CombinedOutput, including when the command fails.
func Dir ¶
Dir returns a command that runs in the given dir. The command can be passed to one of the other funcs in this package to evaluate it and optionally get the output as a string. Dir is useful to construct one-liner command calls, because setting the dir is commonly needed and not settable with exec.Command directly.
func MakeWorkDir ¶
MakeWorkDir creates a unique path inside the given root dir to use as a workspace. The name starts with the local time in a sortable format to help with browsing multiple workspaces. This function allows a command to run multiple times in sequence without overwriting or deleting the old data, for diagnostic purposes. This function uses os.MkdirAll to ensure the root dir exists.
func Output ¶ added in v0.0.17
Output runs a command and returns stdout without mixing in stderr. If the command fails, stderr is included in the returned error for diagnostics.
Types ¶
This section is empty.