Documentation
¶
Overview ¶
This package provides an interface to functions and structs in the standard os/exec package to facilitate mocking.
Index ¶
- Variables
- func NewExec() execFacade
- type Cmd
- type CommandOption
- func WithArgs(args ...string) CommandOption
- func WithCancel(f func() error) CommandOption
- func WithContext(ctxt context.Context) CommandOption
- func WithDir(dir string) CommandOption
- func WithEnv(name, value string) CommandOption
- func WithExtraFiles(files []*os.File) CommandOption
- func WithStderr(w io.Writer) CommandOption
- func WithStdin(r io.Reader) CommandOption
- func WithStdout(w io.Writer) CommandOption
- func WithSysProcAttr(spa *syscall.SysProcAttr) CommandOption
- func WithWaitDelay(d time.Duration) CommandOption
- type Error
- type Exec
- type ExitError
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDot = exec.ErrDot ErrNotFound = exec.ErrNotFound ErrWaitDelay = exec.ErrWaitDelay )
Functions ¶
Types ¶
type Cmd ¶
type Cmd interface {
// Access to member variables:
Path() string
Args() []string
Env() []string
Dir() string
Stdin() io.Reader
Stdout() io.Writer
Stderr() io.Writer
Process() *os.Process
ProcessState() *os.ProcessState
// Members:
CombinedOutput() ([]byte, error)
Environ() []string
Output() ([]byte, error)
Run() error
Start() error
StderrPipe() (io.ReadCloser, error)
StdinPipe() (io.WriteCloser, error)
StdoutPipe() (io.ReadCloser, error)
String() string
Wait() error
}
type CommandOption ¶
type CommandOption func(*cmdFacade)
func WithArgs ¶
func WithArgs(args ...string) CommandOption
func WithCancel ¶
func WithCancel(f func() error) CommandOption
func WithContext ¶
func WithContext(ctxt context.Context) CommandOption
func WithDir ¶
func WithDir(dir string) CommandOption
func WithEnv ¶
func WithEnv(name, value string) CommandOption
func WithExtraFiles ¶
func WithExtraFiles(files []*os.File) CommandOption
func WithStderr ¶
func WithStderr(w io.Writer) CommandOption
func WithStdin ¶
func WithStdin(r io.Reader) CommandOption
func WithStdout ¶
func WithStdout(w io.Writer) CommandOption
func WithSysProcAttr ¶
func WithSysProcAttr(spa *syscall.SysProcAttr) CommandOption
func WithWaitDelay ¶
func WithWaitDelay(d time.Duration) CommandOption
Click to show internal directories.
Click to hide internal directories.