executor

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Index

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

type MockCommand struct {
	mock.Mock
}

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

type MockCommandExecutor struct {
	mock.Mock
}

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

func (m *MockCommandExecutor) CommandContext(ctx context.Context, name string, args ...string) Command

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.

Jump to

Keyboard shortcuts

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