Documentation ¶
Overview ¶
Package exec provides useful wrappers around the standard "exec" library.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cmd ¶
Cmd wraps exec.Cmd with a context to provide convenient execution of a command with nice checking of the context timeout in the form:
err := exec.Prog().WithTimeout(5*time.Second, myprog, myargs...).CombinedOutput(log, verbose)
func CommandContext ¶
CommandContext wraps exec.CommandContext to allow this package to be used as a drop-in replacement for the standard exec library.
func WithCancel ¶
WithCancel creates a Cmd with a context that can be cancelled by calling the resulting Cancel() function.
func WithTimeout ¶
WithTimeout creates a Cmd with a context that times out after the specified duration.
func (*Cmd) CombinedOutput ¶
CombinedOutput runs the command and returns its combined standard output and standard error. Unlike the standard library, if the context is exceeded, it will return an error indicating so.
Logs any errors that occur to the specified logger.