Documentation
¶
Overview ¶
Package execx centralizes process execution behind mockable entry points.
Historically each cmd package declared its own `var execCommand = exec.Command` / `lookPath = exec.LookPath`, scattering ~100 direct os/exec call sites. New code should use this package; existing call sites migrate incrementally.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Command = exec.Command CommandContext = exec.CommandContext LookPath = exec.LookPath )
Mockable function variables. Tests may stub these.
Functions ¶
This section is empty.
Types ¶
type DefaultRunner ¶
type DefaultRunner struct{}
DefaultRunner is the production Runner.
func (DefaultRunner) CommandContext ¶
CommandContext creates an exec.Cmd bound to ctx.
type Runner ¶
type Runner interface {
CommandContext(ctx context.Context, name string, args ...string) *exec.Cmd
LookPath(file string) (string, error)
}
Runner is a minimal interface for running external processes. DefaultRunner delegates to os/exec; tests provide fakes.
var Default Runner = DefaultRunner{}
Default is the production Runner instance.
Click to show internal directories.
Click to hide internal directories.