exec

package
v1.221.0-rc.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

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

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockCommandExecutor) LookPath

func (m *MockCommandExecutor) LookPath(file string) (string, error)

LookPath mocks base method.

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.

func (*MockCommandExecutorMockRecorder) LookPath

func (mr *MockCommandExecutorMockRecorder) LookPath(file any) *gomock.Call

LookPath indicates an expected call of LookPath.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL