Documentation
¶
Index ¶
- Variables
- type Command
- type CommandExecutor
- type MockCommand
- func (m *MockCommand) CombinedOutput() ([]byte, error)
- func (m *MockCommand) GetProcess() any
- func (m *MockCommand) GetProcessState() any
- func (m *MockCommand) Output() ([]byte, error)
- func (m *MockCommand) Run() error
- func (m *MockCommand) SetDir(dir string)
- func (m *MockCommand) SetEnv(env []string)
- func (m *MockCommand) SetStderr(stderr any)
- func (m *MockCommand) SetStdout(stdout any)
- func (m *MockCommand) Start() error
- func (m *MockCommand) StderrPipe() (any, error)
- func (m *MockCommand) StdoutPipe() (any, error)
- func (m *MockCommand) Wait() error
- type MockCommandExecutor
- type OSCommandExecutor
Constants ¶
This section is empty.
Variables ¶
View Source
var NewOSCommandExecutor = newOSCommandExecutor
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command interface {
Output() ([]byte, error)
CombinedOutput() ([]byte, error)
Run() error
Start() error
Wait() error
StdoutPipe() (any, error)
StderrPipe() (any, error)
SetDir(dir string)
SetEnv(env []string)
SetStdout(stdout any)
SetStderr(stderr any)
GetProcess() any
GetProcessState() any
}
Command represents a command that can be executed.
type CommandExecutor ¶
type CommandExecutor interface {
CommandContext(ctx context.Context, name string, args ...string) Command
}
CommandExecutor provides an interface for executing commands.
type MockCommand ¶
MockCommand is a mock implementation of Command for testing.
func NewMockCommand ¶
func NewMockCommand() *MockCommand
func (*MockCommand) CombinedOutput ¶
func (m *MockCommand) CombinedOutput() ([]byte, error)
func (*MockCommand) GetProcess ¶
func (m *MockCommand) GetProcess() any
func (*MockCommand) GetProcessState ¶
func (m *MockCommand) GetProcessState() any
func (*MockCommand) Output ¶
func (m *MockCommand) Output() ([]byte, error)
func (*MockCommand) Run ¶
func (m *MockCommand) Run() error
func (*MockCommand) SetDir ¶
func (m *MockCommand) SetDir(dir string)
func (*MockCommand) SetEnv ¶
func (m *MockCommand) SetEnv(env []string)
func (*MockCommand) SetStderr ¶
func (m *MockCommand) SetStderr(stderr any)
func (*MockCommand) SetStdout ¶
func (m *MockCommand) SetStdout(stdout any)
func (*MockCommand) Start ¶
func (m *MockCommand) Start() error
func (*MockCommand) StderrPipe ¶
func (m *MockCommand) StderrPipe() (any, error)
func (*MockCommand) StdoutPipe ¶
func (m *MockCommand) StdoutPipe() (any, error)
func (*MockCommand) Wait ¶
func (m *MockCommand) Wait() error
type MockCommandExecutor ¶
MockCommandExecutor is a mock implementation of CommandExecutor for testing.
func NewMockCommandExecutor ¶
func NewMockCommandExecutor() *MockCommandExecutor
func SetupMockCommandExecutor ¶
func SetupMockCommandExecutor(t *testing.T) *MockCommandExecutor
func (*MockCommandExecutor) CommandContext ¶
type OSCommandExecutor ¶
type OSCommandExecutor struct{}
func (*OSCommandExecutor) CommandContext ¶
func (e *OSCommandExecutor) CommandContext(ctx context.Context, name string, args ...string) Command
CommandContext creates a real os/exec command.
Click to show internal directories.
Click to hide internal directories.