execers

package
v0.0.2-alpha Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const UseSimExecerArg = "#! sim execer"

A placeholder string that indicates a command should be run on SimExecer

Variables

This section is empty.

Functions

func MakeSimExecerInterceptor

func MakeSimExecerInterceptor(simExecer, delegate execer.Execer) execer.Execer

Create an InterceptExecer that will send cmd's to simExecer or delegate

func StartsWithSimExecer

func StartsWithSimExecer(cmd execer.Command) bool

Returns whether cmd's first arg starts with UseSimExecerArg

Types

type DoneExecer

type DoneExecer struct {
	State     execer.ProcessState
	ExitCode  errors.ExitCode
	ExecError error
}

doneExecer finishes something as soon as its run

func NewDoneExecer

func NewDoneExecer() *DoneExecer

Creates a new doneExecer.

func (*DoneExecer) Abort

func (e *DoneExecer) Abort() execer.ProcessStatus

func (*DoneExecer) Exec

func (e *DoneExecer) Exec(command execer.Command) (execer.Process, error)

func (*DoneExecer) Wait

func (e *DoneExecer) Wait() execer.ProcessStatus

type ErrExecer

type ErrExecer struct {
	Err error
}

func (*ErrExecer) Exec

func (e *ErrExecer) Exec(command execer.Command) (execer.Process, error)

type InterceptExecer

type InterceptExecer struct {
	Condition   func(execer.Command) bool
	Interceptor execer.Execer
	Default     execer.Execer
}

InterceptExecer is a Composite Execer. For each command c, if Condition(c), InterceptExecer delegates to Interceptor, otherwise Default

func (*InterceptExecer) Exec

func (e *InterceptExecer) Exec(command execer.Command) (execer.Process, error)

type SimExecer

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

func NewSimExecer

func NewSimExecer() *SimExecer

func (*SimExecer) Exec

func (e *SimExecer) Exec(command execer.Command) (execer.Process, error)

SimExecer execs by simulating running argv. each arg in command.argv is simulated in order. valid args are: complete <exitcode int>

complete with exitcode

pause

pause until SimExecer.Resume() is called

sleep <millis int>

sleep for millis milliseconds

stdout <message>

put <message> in stdout in the response

stderr <message>

put <message> in stderr in the response

NB: SimExecer is often hid behind an InterceptExecer, so you should pass argv[0] as "#! sim execer" (Cf. intercept.go)

func (*SimExecer) Resume

func (e *SimExecer) Resume()

Jump to

Keyboard shortcuts

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