Documentation ¶
Index ¶
- func Args(args ...string) func(*exec.Cmd) error
- func Cmd(cmd string, decorators ...func(*exec.Cmd) error) (*exec.Cmd, error)
- func Cwd(dir string) func(*exec.Cmd) error
- func Env(env map[string]string) func(*exec.Cmd) error
- func EnvCombined(env map[string]string) func(*exec.Cmd) error
- func Pipe(cmds ...*exec.Cmd) error
- func PipeBuffered(cmds ...*exec.Cmd) (stdOutBuf, stdErrBuf []byte, err error)
- func PipePrefixed(prefix string, cmds ...*exec.Cmd) error
- func Run(cmd string, args ...string) func() error
- func RunBuffered(cmd string, args ...string) (stdOutBuf, stdErrBuf string, err error)
- func RunBufferedCmd(cmd *exec.Cmd) (stdOutBuf, stdErrBuf []byte, err error)
- func RunPrefixed(prefix, cmd string, args ...string) func() error
- func RunPrefixedCmd(prefix string, cmd *exec.Cmd) error
- func SetErr(err io.Writer) func(*exec.Cmd) error
- func SetIn(in io.Reader) func(*exec.Cmd) error
- func SetOut(out io.Writer) func(*exec.Cmd) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Cmd ¶
Cmd provides a fluent, decorator based API for os/exec. Eg: Cmd("ping", Args("-c", "4", "1.1.1.1"))
func EnvCombined ¶
EnvCombined will add the variables you provide to the existing environment
func PipeBuffered ¶
PipeBuffered will buffer all StdOut and StdErr, returning the buffers. This is useful when you wish to parse the results of a pipe.
func PipePrefixed ¶
PipePrefixed will prefix all StdOut and StdErr with given prefix. This is useful when running many pipes concurrently, output will look similar to docker-compose.
func Run ¶
Run is a convenience function for simple cases. Instead of: Cmd("ping", Args("-c", "4", "8.8.8.8")).Run() You might write: Run("ping", "-c", "4", "8.8.8.8")
NOTE: A closure is returned thus making for nicer syntax when used with run.Serial/Parallel functions. If using standalone you will need to invoke the returned closure.
func RunBuffered ¶
RunBuffered is a convenience function for simple cases. Instead of: RunBufferedCmd(Cmd("ping", Args("-c", "4", "8.8.8.8"))) You might write: RunBuffered("ping", "-c", "4", "8.8.8.8")
func RunBufferedCmd ¶
RunBufferedCmd will buffer all StdOut and StdErr, returning the buffers. This is useful when you wish to parse the results of a command.
func RunPrefixed ¶
RunPrefixed is a convenience function for simple cases. Instead of: RunPrefixedCmd("foo", Cmd("ping", Args("-c", "4", "8.8.8.8"))) You might write: RunPrefixed("foo", "ping", "-c", "4", "8.8.8.8")
NOTE: A closure is returned thus making for nicer syntax when used with run.Serial/Parallel functions. If using standalone you will need to invoke the returned closure.
func RunPrefixedCmd ¶
RunPrefixedCmd will prefix all StdOut and StdErr with given prefix. This is useful when running many commands concurrently, output will look similar to docker-compose.
Types ¶
This section is empty.