Documentation ¶
Overview ¶
Package exec contains an interface for executing commands, along with helpers TODO(bentheelder): add standardized timeout functionality & a default timeout so that commands cannot hang indefinitely (!)
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultCmder = &LocalCmder{}
DefaultCmder is a LocalCmder instance used for convienience, packages originally using os/exec.Command can instead use pkg/kind/exec.Command which forwards to this instance TODO(bentheelder): swap this for testing TODO(bentheelder): consider not using a global for this :^)
Functions ¶
func CombinedOutputLines ¶
CombinedOutputLines is like os/exec's cmd.CombinedOutput(), but over our Cmd interface, and instead of returning the byte buffer of stderr + stdout, it scans these for lines and returns a slice of output lines
func InheritOutput ¶
func InheritOutput(cmd Cmd)
InheritOutput sets cmd's output to write to the current process's stdout and stderr
func RunLoggingOutputOnFail ¶
RunLoggingOutputOnFail runs the cmd, logging error output if Run returns an error
Types ¶
type Cmd ¶
type Cmd interface { Run() error // Each entry should be of the form "key=value" SetEnv(...string) SetStdin(io.Reader) SetStdout(io.Writer) SetStderr(io.Writer) }
Cmd abstracts over running a command somewhere, this is useful for testing