capture

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScannerInitBuf = 64 * 1024   // 64 KB initial buffer
	ScannerMaxBuf  = 1024 * 1024 // 1 MB max buffer
)

Scanner buffer sizes for reading subprocess output.

Variables

This section is empty.

Functions

func CommandName

func CommandName(args []string) string

CommandName returns the actual command name from args, skipping leading KEY=VALUE environment variable assignments.

Types

type LineFilter

type LineFilter func(line string) bool

LineFilter decides whether a line should be forwarded.

type LongRunner

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

LongRunner captures output from a long-running subprocess with debounce. Unlike Runner which flushes in batches of N lines, LongRunner collects output and flushes at regular intervals (debounce duration).

func NewLongRunner

func NewLongRunner(s store.Store, sessionID, tag string, filter LineFilter, debounce time.Duration) *LongRunner

NewLongRunner creates a new LongRunner with the specified debounce duration.

func (*LongRunner) Run

func (r *LongRunner) Run(args []string) (*RunResult, error)

Run executes the command and captures output with debounced flushing. It forwards signals (SIGINT, SIGTERM) to the child process.

type RunResult

type RunResult struct {
	ExitCode int
}

RunResult holds the result of a subprocess execution.

type Runner

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

Runner captures subprocess output and writes it to a store.

func New

func New(s store.Store, sessionID, tag string, filter LineFilter) *Runner

New creates a new Runner.

func (*Runner) Run

func (r *Runner) Run(args []string) (*RunResult, error)

Run executes the given command, captures stdout/stderr, passes them through to the terminal transparently, and writes captured output to the store.

Jump to

Keyboard shortcuts

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