exec

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package exec provides abstractions for command execution. This package enables testable code by allowing CLI commands to be mocked.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandExecutor

type CommandExecutor interface {
	// Execute runs a command with the given context and arguments.
	// Returns stdout, stderr, and any error that occurred.
	Execute(ctx context.Context, name string, args ...string) (stdout []byte, stderr []byte, err error)
}

CommandExecutor defines an interface for executing shell commands. This abstraction allows for mocking CLI tool behavior in tests.

func DefaultExecutor

func DefaultExecutor() CommandExecutor

DefaultExecutor returns the standard production executor. This is used as the default when no executor is injected.

type RealCommandExecutor

type RealCommandExecutor struct{}

RealCommandExecutor executes actual shell commands using os/exec. This is the production implementation.

func (*RealCommandExecutor) Execute

func (r *RealCommandExecutor) Execute(ctx context.Context, name string, args ...string) ([]byte, []byte, error)

Execute runs an actual shell command.

Jump to

Keyboard shortcuts

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