Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PipeCommands ¶
PipeCommands will pipe two commands together and return the output
Types ¶
type Cmder ¶
type Cmder interface {
Run() error
Start() error
String() string
CombinedOutput() ([]byte, error)
Output() ([]byte, error)
SimpleOutput() ([]byte, int)
StdinPipe() (io.WriteCloser, error)
StderrPipe() (io.ReadCloser, error)
StdoutPipe() (io.ReadCloser, error)
Wait() error
// contains filtered or unexported methods
}
Cmder interface wraps the os/exec Cmd struct
type Creator ¶
type Creator interface {
Command(name string, arg ...string) Cmder
CommandContext(ctx context.Context, name string, arg ...string) Cmder
}
Creator is the interface used to create either a mock or real os/exec Cmd
type MockCreator ¶
type MockCreator interface {
Creator
}
MockCreator is the interface used to create a mock os/exec Cmd
func NewMockCreator ¶
func NewMockCreator(instances []MockInstance) MockCreator
NewMockCreator instantiates a mock os/exec factory
type MockInstance ¶
type MockInstance struct {
RunErr error
StartErr error
CombinedOutputVal []byte
CombinedOutputErr error
OutputVal []byte
OutputErr error
SimpleOutputOut []byte
SimpleOutputExitCode int
StdinPipeVal io.WriteCloser
StdinPipeErr error
StderrPipeVal io.ReadCloser
StderrPipeErr error
StdoutPipeVal io.ReadCloser
StdoutPipeErr error
WaitErr error
}
MockInstance defines the returned values of the mock Cmd method calls
Click to show internal directories.
Click to hide internal directories.