isolatedprocess

package
v0.44.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 9 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

Overview

Package isolatedprocess starts every program that reads outsider bytes. Each such program runs in an empty directory of its own, with an environment of PATH, HOME, TMPDIR and LANG alone, and inherits no credential of the worker. A program that needs a login of its own, as claude does, names the variables that carry it, and inherits those alone. A worker that runs one has called worker.MarkUndumpable, so the program cannot read the worker's own environment through /proc either.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, c Command) (string, error)

Run runs c until it exits or ctx ends, and answers the end of its stderr. A program that exits non-zero answers an *ExitError.

Types

type Command

type Command struct {
	Path string
	Args []string
	// Files are written into the run's directory before it starts, each
	// under its name, so Args can name them by a relative path.
	Files map[string]string
	Stdin io.Reader
	// Stdout reads the program's stdout while it runs. A read that fails
	// kills the run, and Run answers the read's error. Nil discards stdout.
	Stdout func(io.Reader) error
	// Inherit names the variables of this process's environment that the
	// run keeps, each a name or a prefix ending in *, such as ANTHROPIC_*.
	// Each replaces the run's own value, so inheriting HOME runs the program
	// with this process's home rather than the run's directory.
	Inherit []string
	// Env holds entries set last, each NAME=value, over every other.
	Env []string
}

Command is one run of a program.

type ExitError

type ExitError struct {
	Program  string
	ExitCode int
	Stderr   string
}

ExitError is a program that exited non-zero, with the end of its stderr.

func (*ExitError) Error

func (e *ExitError) Error() string

Jump to

Keyboard shortcuts

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