execution

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 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

Overview

Package execution runs bounded subprocesses inside a validated workspace.

Index

Constants

This section is empty.

Variables

View Source
var ErrOutputLimit = errors.New("subprocess output limit exceeded")

ErrOutputLimit indicates that stdout or stderr crossed its configured cap.

Functions

This section is empty.

Types

type Command

type Command struct {
	Name string
	Args []string
	Dir  string
	Env  map[string]string
}

Command describes one subprocess invocation.

type Config

type Config struct {
	MaxConcurrent int
	Timeout       time.Duration
	OutputLimit   int64
}

Config controls process-wide subprocess limits.

type Result

type Result struct {
	ExitCode int
	Duration time.Duration
}

Result describes a completed subprocess, including ordinary non-zero exits.

type Runner

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

Runner owns workspace containment, deadlines, concurrency, and output caps.

func New

func New(ws *workspace.Workspace, config Config) (*Runner, error)

New returns a runner with validated defaults for every zero-valued limit.

func (*Runner) Deadline

func (r *Runner) Deadline(ctx context.Context) (context.Context, context.CancelFunc)

Deadline applies the process-wide maximum tool duration to a handler. Tool handlers call it once so package resolution and execution share one budget.

func (*Runner) ForWorkspace

func (r *Runner) ForWorkspace(ws *workspace.Workspace) (*Runner, error)

ForWorkspace returns a runner contained to another validated workspace while sharing this runner's process budget. It is used for server-created worktrees.

func (*Runner) Permit

func (r *Runner) Permit(ctx context.Context) (func(), error)

Permit reserves one slot from the process-wide load budget for expensive in-process work such as package loading and static analysis.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, command Command, streams Streams) (Result, error)

Run executes command inside the workspace. A normal non-zero process exit is returned in Result; containment, cancellation, spawn, and output failures are returned as errors.

type Streams

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

Streams receive bounded subprocess output. Nil writers discard that stream.

Jump to

Keyboard shortcuts

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