Documentation
¶
Index ¶
- Variables
- type Cmd
- func (c *Cmd) Directory(dir string) *Cmd
- func (c *Cmd) Env(env []string) *Cmd
- func (c *Cmd) ExpectSuccess() *Cmd
- func (c *Cmd) LogFn(fn PrintfFn) *Cmd
- func (c *Cmd) LogPrefix(prefix string) *Cmd
- func (c *Cmd) Run(ctx context.Context) (*Result, error)
- func (c *Cmd) RunCombinedOut(ctx context.Context) (*ResultOut, error)
- func (c *Cmd) Stderr(w io.Writer) *Cmd
- func (c *Cmd) Stdout(w io.Writer) *Cmd
- type ExitCodeError
- type PrintfFn
- type Result
- type ResultOut
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultLogFn is the default debug print function. DefaultLogFn = func(string, ...interface{}) {} // DefaultLogPrefix is the default prefix that is prepended to messages passed to the debugf function. DefaultLogPrefix = "exec: " // DefaultStderrColorFn is the default function that is used to colorize stderr output that is streamed to the log function. DefaultStderrColorFn = color.New(color.FgRed).SprintFunc() )
Functions ¶
This section is empty.
Types ¶
type Cmd ¶
type Cmd struct {
// contains filtered or unexported fields
}
func (*Cmd) ExpectSuccess ¶
ExpectSuccess if called, Run() will return an error if the command did not exit with code 0.
func (*Cmd) LogPrefix ¶ added in v3.1.0
LogPrefix defines a string that is used as prefix for all messages written via *Cmd.LogFn.
func (*Cmd) RunCombinedOut ¶ added in v3.1.0
RunCombinedOut executes the command and stores the combined stdout and stderr output of the process in ResultOut.CombinedOutput.
type ExitCodeError ¶
type ExitCodeError struct {
*Result
}
ExitCodeError is returned from Run() when a command exited with a code != 0.
func (ExitCodeError) Error ¶
func (e ExitCodeError) Error() string
Error returns the error description.
Click to show internal directories.
Click to hide internal directories.