execx

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: Apache-2.0, MIT Imports: 6 Imported by: 0

Documentation

Overview

Package execx runs external programs with the release CLI's shared process policy.

Run resolves one executable, starts it without a shell, forwards configured output streams, retains a bounded stderr tail, and bounds waits on leaked child I/O. Tool adapters remain responsible for argument construction, domain validation, secret handling, output parsing, and error presentation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, command Command) error

Run resolves and invokes command once.

Run rejects a nil context and an empty executable selection before starting a process. It returns the context error when cancellation or deadline expiry ends the process. Other process failures are returned as *RunError.

Types

type Command

type Command struct {
	// Program is the PATH name used when Path is empty.
	Program string

	// Path overrides Program when nonempty. Run resolves the selected value
	// through [exec.LookPath] at invocation time.
	Path string

	// Args is the argument list excluding argv[0]. Run passes it directly to
	// [exec.CommandContext] and never invokes a shell.
	Args []string

	// Dir is the child working directory. An empty value inherits the parent
	// working directory.
	Dir string

	// Env is the child environment. A nil value inherits the parent
	// environment; a nonnil value is used as-is.
	Env []string

	// Stdout receives child stdout. A nil value discards stdout.
	Stdout io.Writer

	// Stderr receives child stderr while the process runs. A nil value discards
	// the live stream. Run retains a bounded tail independently.
	Stderr io.Writer
}

Command describes one external program invocation.

type RunError

type RunError struct {
	// contains filtered or unexported fields
}

RunError reports a process start, wait, or nonzero-exit failure.

It retains the underlying error and a bounded stderr tail without retaining argv or the child environment.

func (*RunError) Error

func (e *RunError) Error() string

Error returns the underlying process error text.

func (*RunError) ExitCode

func (e *RunError) ExitCode() (int, bool)

ExitCode returns the process exit code and whether one was available.

func (*RunError) StderrTail

func (e *RunError) StderrTail() string

StderrTail returns the bounded trailing stderr captured during the run.

func (*RunError) Unwrap

func (e *RunError) Unwrap() error

Unwrap returns the underlying process error.

Jump to

Keyboard shortcuts

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