Documentation
¶
Overview ¶
Package execx defines the injectable external-command runner the orchestration core uses for git, gh, and host CLIs. Commands are always argument vectors — never shell strings. Before the OpenCode native binding repair this comment claimed that alone prevented shell interpretation; launchers (notably Windows batch files) can interpret forwarded arguments. Run does not make arbitrary launchers safe; OpenCode verifies its own native command before passing host-derived arguments. A non-zero exit is data in Result, not an error: callers that need exit codes as information (PRD §16 reproduce-on-base) read them directly, and callers for whom non-zero means failure convert it themselves.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cmd ¶
type Cmd struct {
// Name is an executable name or path; the runner uses LookPath.
Name string
// Args is passed as an argument vector, not a shell string. A selected
// launcher can still interpret it; callers must enforce any native-only rule.
Args []string
// Dir is the working directory. It is required: an implicit
// inherited cwd would make command behavior depend on ambient
// process state, so an empty Dir is an error (fail closed).
Dir string
// Env holds KEY=VALUE pairs appended to os.Environ(). Later
// entries win, so callers can override inherited variables.
// nil adds nothing.
Env []string
// Stdin is the process input; nil means no input.
Stdin io.Reader
}
Cmd describes one external command invocation.
type Local ¶
type Local struct {
// LookPath resolves an executable name; defaults to exec.LookPath.
LookPath func(string) (string, error)
}
Local is the production Runner backed by os/exec.
func (Local) ResolvePath ¶ added in v0.17.0
ResolvePath exposes the same injected lookup used by Run, so a caller can qualify and retain a particular executable without changing Runner's contract.
type Result ¶
Result carries everything a caller needs to interpret an invocation that ran to completion.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package execxtest provides a scripted fake execx.Runner for transcript tests: each expected call is asserted in order and answered with a recorded result, so tests pin the exact argument vectors the core sends to git and gh without running either.
|
Package execxtest provides a scripted fake execx.Runner for transcript tests: each expected call is asserted in order and answered with a recorded result, so tests pin the exact argument vectors the core sends to git and gh without running either. |