cmdext

package
v0.0.623 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrExitCode = errors.New("process exited with an unexpected exitcode")
View Source
var ErrStderrPrint = errors.New("process did print to stderr stream")
View Source
var ErrTimeout = errors.New("process did not exit after the specified timeout")

Functions

This section is empty.

Types

type CommandListener

type CommandListener interface {
	ReadRawStdout([]byte)
	ReadRawStderr([]byte)

	ReadStdoutLine(string)
	ReadStderrLine(string)

	Finished(int)
	Timeout()
}

type CommandResult

type CommandResult struct {
	StdOut          string
	StdErr          string
	StdCombined     string
	ExitCode        int
	CommandTimedOut bool
}

func RunCommand

func RunCommand(program string, args []string, timeout *time.Duration) (CommandResult, error)

type CommandRunner

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

func Runner

func Runner(program string) *CommandRunner

func (*CommandRunner) Arg

func (r *CommandRunner) Arg(arg string) *CommandRunner

func (*CommandRunner) Args

func (r *CommandRunner) Args(arg []string) *CommandRunner

func (*CommandRunner) EnsureExitcode

func (r *CommandRunner) EnsureExitcode(arg ...int) *CommandRunner

func (*CommandRunner) Env

func (r *CommandRunner) Env(key, value string) *CommandRunner

func (*CommandRunner) Envs

func (r *CommandRunner) Envs(env []string) *CommandRunner

func (*CommandRunner) FailOnExitCode

func (r *CommandRunner) FailOnExitCode() *CommandRunner

func (*CommandRunner) FailOnStderr

func (r *CommandRunner) FailOnStderr() *CommandRunner

func (*CommandRunner) FailOnTimeout

func (r *CommandRunner) FailOnTimeout() *CommandRunner

func (*CommandRunner) Listen

func (r *CommandRunner) Listen(lstr CommandListener) *CommandRunner

func (*CommandRunner) ListenStderr

func (r *CommandRunner) ListenStderr(lstr func(string)) *CommandRunner

func (*CommandRunner) ListenStdout

func (r *CommandRunner) ListenStdout(lstr func(string)) *CommandRunner

func (*CommandRunner) RawEnv

func (r *CommandRunner) RawEnv(env string) *CommandRunner

func (*CommandRunner) Run

func (r *CommandRunner) Run() (CommandResult, error)

func (*CommandRunner) Timeout

func (r *CommandRunner) Timeout(timeout time.Duration) *CommandRunner

Jump to

Keyboard shortcuts

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