process

package
v1.221.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultRunner

type DefaultRunner struct{}

DefaultRunner executes tasks with os/exec.

func (DefaultRunner) Run

func (r DefaultRunner) Run(ctx context.Context, spec TaskSpec) (result Result)

Run executes spec with context-aware cancellation and exit-code preservation.

type Result

type Result struct {
	Command    string
	Args       []string
	ExitCode   int
	Err        error
	Started    bool
	Canceled   bool
	StartedAt  time.Time
	FinishedAt time.Time
}

Result contains the outcome of a subprocess invocation.

func (Result) Success

func (r Result) Success() bool

Success reports whether the subprocess completed with exit code 0.

type Runner

type Runner interface {
	Run(ctx context.Context, spec TaskSpec) Result
}

Runner executes a task and returns the observed process result.

func NewDefaultRunner

func NewDefaultRunner() Runner

NewDefaultRunner returns a Runner backed by os/exec.

type Streams

type Streams struct {
	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer
}

Streams contains the standard streams passed to a subprocess.

func OSStreams

func OSStreams() Streams

OSStreams returns streams connected to the current process standard streams.

type TaskSpec

type TaskSpec struct {
	Command string
	Args    []string
	Dir     string
	Env     []string
	Streams Streams
	DryRun  bool
}

TaskSpec describes a subprocess invocation.

Jump to

Keyboard shortcuts

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