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: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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