Documentation
¶
Overview ¶
Package process is the single bridge between os/exec and the runtime environment's status (narration) and result (typed payload) channels.
Every provider that shells out goes through Runner so line-splitting, dry-run, cancellation, and error wrapping live in exactly one place.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner executes os/exec commands with stdout and stderr routed through the configured status and result channels.
func NewRunner ¶
func NewRunner(ctx context.Context, dryRun bool, pipeline *result.Pipeline, narrator *status.Narrator) *Runner
NewRunner constructs a Runner bound to the given runtime values.
Parameters:
- ctx: cancellation signal for the subprocess; when Done, the subprocess is killed.
- dryRun: when true, narrate the command but skip execution.
- pipeline: typed-payload pipeline consumed by Emit.
- narrator: narrator for stdout and stderr line streams and pre-execution narration.
Returns:
- *Runner: the initialized runner.
func (*Runner) Capture ¶
Capture executes cmd, returning stdout bytes verbatim and streaming stderr through ctx.Status.Warn.
In dry-run, narrates the command and returns nil bytes with a nil error.
Parameters:
- cmd: the prepared exec.Cmd; its Stdout, Stderr, and Cancel fields are overwritten by the runner.
Returns:
- []byte: the captured stdout (nil in dry-run).
- error: a wrapped exit-error carrying the command path and exit code on non-zero exit; full stderr remains available to the caller via the streamed status messages.
func (*Runner) Emit ¶
Emit captures stdout, applies parse to produce a typed value, then forwards the value to ctx.Result.Emit.
Stderr streams through ctx.Status.Warn. In dry-run, narrates the command and returns nil without invoking parse.
Parameters:
- cmd: the prepared exec.Cmd
- parse: converts captured stdout bytes into the typed value forwarded to the result sink
Returns:
- error: a wrapped exit-error, parse error, or sink error; nil on success
func (*Runner) Run ¶
Run executes cmd, streaming stdout through ctx.Status.Note and stderr through ctx.Status.Warn line-by-line.
In dry-run, narrates the command and returns nil without launching it.
Parameters:
- cmd: the prepared exec.Cmd; its Stdout, Stderr, and Cancel fields are overwritten by the runner.
Returns:
- error: a wrapped exit-error carrying the command path and exit code on non-zero exit; full stderr remains available to the caller via the streamed status messages.