cre

package
v0.91.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLIRunner

type CLIRunner struct {

	// Stdout, if set, receives a real-time copy of the process stdout while it runs.
	Stdout io.Writer
	// Stderr, if set, receives a real-time copy of the process stderr while it runs.
	Stderr io.Writer
	// contains filtered or unexported fields
}

CLIRunner runs the CRE CLI via os/exec. Run executes the binary and captures stdout/stderr.

func NewCLIRunner

func NewCLIRunner(binaryPath string) *CLIRunner

NewCLIRunner returns a CLIRunner for the given binary path. An empty path defaults to "cre" (resolved via PATH).

func (*CLIRunner) Run

func (r *CLIRunner) Run(ctx context.Context, args ...string) (*CallResult, error)

Run executes the binary and captures stdout and stderr. Exit code 0 returns (res, nil); exit code != 0 returns (res, *ExitError) so callers get both result and error. Runner-related failures (binary not found, context canceled) return (nil, err).

type CallResult

type CallResult struct {
	Stdout   []byte
	Stderr   []byte
	ExitCode int
}

CallResult holds stdout, stderr, and exit code from a completed CRE call.

type ExitError

type ExitError struct {
	ExitCode int
	Stdout   []byte
	Stderr   []byte
}

ExitError is returned when the CRE process ran and exited with a non-zero code. Use errors.As to inspect ExitCode, Stdout, and Stderr. Result is still returned from Run (for example Runner.Run or CLIRunner.Run) so callers can log or inspect output.

func (*ExitError) Error

func (e *ExitError) Error() string

type Runner

type Runner interface {
	Run(ctx context.Context, args ...string) (*CallResult, error)
}

Runner is used to invoke the CRE CLI.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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