Documentation
¶
Overview ¶
Package exec provides a small, mockable abstraction over the standard library os/exec package so that command execution can be substituted in unit tests without spawning real processes.
Package exec is a generated GoMock package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandExecutor ¶
type CommandExecutor interface {
// LookPath searches for an executable named file in PATH.
LookPath(file string) (string, error)
// CommandContext creates an exec.Cmd configured to run with the given context.
CommandContext(ctx context.Context, name string, args ...string) *exec.Cmd
}
CommandExecutor provides an abstraction for executing system commands. This interface allows for mocking command execution in unit tests.
func Default ¶
func Default() CommandExecutor
Default returns a CommandExecutor backed by the standard library os/exec package.
type MockCommandExecutor ¶
type MockCommandExecutor struct {
// contains filtered or unexported fields
}
MockCommandExecutor is a mock of CommandExecutor interface.
func NewMockCommandExecutor ¶
func NewMockCommandExecutor(ctrl *gomock.Controller) *MockCommandExecutor
NewMockCommandExecutor creates a new mock instance.
func (*MockCommandExecutor) CommandContext ¶
func (m *MockCommandExecutor) CommandContext(ctx context.Context, name string, args ...string) *exec.Cmd
CommandContext mocks base method.
func (*MockCommandExecutor) EXPECT ¶
func (m *MockCommandExecutor) EXPECT() *MockCommandExecutorMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockCommandExecutorMockRecorder ¶
type MockCommandExecutorMockRecorder struct {
// contains filtered or unexported fields
}
MockCommandExecutorMockRecorder is the mock recorder for MockCommandExecutor.
func (*MockCommandExecutorMockRecorder) CommandContext ¶
func (mr *MockCommandExecutorMockRecorder) CommandContext(ctx, name any, args ...any) *gomock.Call
CommandContext indicates an expected call of CommandContext.