runner

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecRunner

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

func NewExecRunner

func NewExecRunner(l *log.Logger) *ExecRunner

func (ExecRunner) Run

func (r ExecRunner) Run(cmd string, options Options) error

func (ExecRunner) RunArgs

func (r ExecRunner) RunArgs(c string, args []string, options Options) error

type Options

type Options struct {
	Env    map[string]string
	Shell  string // shell invocation, e.g. "sh -c" or "cmd /c"
	Stdout io.Writer
	Stderr io.Writer
}

func NewOptions

func NewOptions() Options

func (Options) WithEnv

func (o Options) WithEnv(env map[string]string) Options

func (Options) WithShell

func (o Options) WithShell(shell string) Options

func (Options) WithStderr

func (o Options) WithStderr(stderr io.Writer) Options

func (Options) WithStdout

func (o Options) WithStdout(stdout io.Writer) Options

func (Options) WithSysEnv

func (o Options) WithSysEnv() Options

type PrintRunner

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

A PrintRunner only prints out what it WOULD run, rather than actually running it.

func NewPrintRunner

func NewPrintRunner(l *log.Logger) *PrintRunner

func (PrintRunner) Run

func (r PrintRunner) Run(cmd string, options Options) error

func (PrintRunner) RunArgs

func (r PrintRunner) RunArgs(cmd string, args []string, options Options) error

type ProcessFailedError

type ProcessFailedError struct {
	Cmd    string
	Code   int
	Reason string
}

func (ProcessFailedError) Error

func (e ProcessFailedError) Error() string

type Runner

type Runner interface {
	Run(cmd string, ops Options) error
	RunArgs(cmd string, args []string, options Options) error
}

a Runner is something that runs commands. How it runs commands is entirely up to the implementation

Jump to

Keyboard shortcuts

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