Documentation ¶
Index ¶
- type Executor
- func (c *Executor) Execute(ctx context.Context, cmd *exec.Cmd) ([]byte, error)
- func (c *Executor) ReadFile(ctx context.Context, path string) ([]byte, error)
- func (c *Executor) Run(ctx context.Context, cmd *exec.Cmd) error
- func (c *Executor) WriteFile(ctx context.Context, path string, data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Executor ¶
type Executor struct { // an error that must be returned (if Func is not set) Err error // an output that must be returned (if Func is not set) Output string // a callback that will be executed instead of an actual shell command. Func func(*exec.Cmd, int) (string, error) // a last executed command LastCmd *exec.Cmd // a number of executed commands ExecutedCount int // what to return when calling ReadFile FileToRead []byte // last file that was written with WriteFile WrittenFileBytes []byte WrittenFilePath string }
Executor is a test implementation of command executor. Always returns the pre-configured results. Remembers the last executed command.
Click to show internal directories.
Click to hide internal directories.