runner

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: MIT Imports: 8 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 runner is the one place sitrep starts other programs (ps, tmux, cmux, claude), so tests can replace them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Key

func Key(name string, args ...string) string

Key is the command line a Fake is keyed by: the name and the arguments, joined by single spaces.

Types

type Cmd

type Cmd struct {
	Name  string
	Args  []string
	Dir   string    // working directory; empty means the caller's
	Env   []string  // the whole environment; nil means the caller's
	Stdin io.Reader // nil means none
	// NewGroup runs the program in its own process group and, when the context ends, kills the whole group: for a program that starts others.
	NewGroup bool
}

Cmd is one program to run.

type Exec

type Exec struct{}

Exec runs the real program.

func (Exec) Run

func (Exec) Run(ctx context.Context, c Cmd) ([]byte, error)

type Fake

type Fake struct {
	Answers map[string]Result
	// contains filtered or unexported fields
}

Fake answers from a table keyed by the command line, and records what it was asked, for tests.

func (*Fake) Calls

func (f *Fake) Calls() []Cmd

Calls lists what was run, in order.

func (*Fake) Run

func (f *Fake) Run(_ context.Context, c Cmd) ([]byte, error)

type Result

type Result struct {
	Out []byte
	Err error
}

Result is one canned answer.

type Runner

type Runner interface {
	Run(ctx context.Context, c Cmd) ([]byte, error)
}

Runner runs a program and returns its standard output.

Jump to

Keyboard shortcuts

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