Documentation ¶
Overview ¶
Package exechelper streamlines the running of external commands while both capturing and logging their output.
It builds on os/exec, expecting an instance of Cmd to manipulate.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
func Run(cmd *exec.Cmd, logger log.FieldLogger, outputLogger OutputLogger) ([]byte, []byte, error)
Run invokes cmd.Run, both logging and returning STDOUT and STDERR, optionally transforming the output first.
func RunWithEnv ¶ added in v0.37.0
func RunWithEnv(cmd *exec.Cmd, logger log.FieldLogger, outputLogger OutputLogger) ([]byte, []byte, error)
RunWithEnv applies environment variables in the command arguments list and then invokes cmd.Run, both logging and returning STDOUT and STDERR, optionally transforming the output first.
Types ¶
type OutputLogger ¶
type OutputLogger func(line string, logger log.FieldLogger)
OutputLogger allows custom logging of the run command output.
Click to show internal directories.
Click to hide internal directories.