cmdrunner

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package cmdrunner wraps os/exec so unit tests can substitute a fake.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fake

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

Fake is a test helper. Use NewFake().Runner() to get a Runner that returns pre-canned responses keyed by full command line.

func NewFake

func NewFake() *Fake

func (*Fake) Calls

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

func (*Fake) Runner

func (f *Fake) Runner() Runner

func (*Fake) Set

func (f *Fake) Set(cmdline string, out []byte, err error)

type Runner

type Runner interface {
	Output(ctx context.Context, name string, args ...string) ([]byte, error)
	Run(ctx context.Context, stdout, stderr io.Writer, name string, args ...string) error
}

Runner runs commands. Real implementation execs; tests use Fake.

func New

func New() Runner

Jump to

Keyboard shortcuts

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