Documentation
¶
Overview ¶
Package exec runs external CLI commands behind a small interface so callers can swap a recording mock in tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CmdRunner ¶
type CmdRunner struct {
DryRun bool
Verbose bool
// Interactive, when true, connects the child process directly to the
// current process's stdin/stdout/stderr instead of capturing output —
// for subprocesses that need a real terminal (e.g. a GPG pinentry
// prompt, a $EDITOR invocation). The stdout/stderr strings returned by
// Run/RunEnv/RunDir are empty in this mode.
Interactive bool
// Out receives dry-run and verbose log lines; defaults to os.Stderr when nil.
Out io.Writer
}
CmdRunner executes external CLI commands, with optional dry-run and verbose modes.
type Runner ¶
type Runner interface {
// Run executes name with args, returning captured stdout and stderr.
Run(name string, args ...string) (string, string, error)
// RunEnv executes name with args, appending env to the current process environment.
RunEnv(env []string, name string, args ...string) (string, string, error)
// RunDir executes name with args in dir (empty = current dir), appending env.
RunDir(dir string, env []string, name string, args ...string) (string, string, error)
}
Runner executes external CLI commands.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package exectest provides test doubles for the exec package: a recording MockRunner and a FakeBin helper for tests that need the real exec path.
|
Package exectest provides test doubles for the exec package: a recording MockRunner and a FakeBin helper for tests that need the real exec path. |