exec

package
v0.0.0-...-eec02a6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFakeExitError

func NewFakeExitError(exitCode int, output string) *exec.ExitError

NewFakeExitError uses a fake exec command shell to generate a fake exit error for testing.

Types

type Command

type Command interface {
	Execute(ctx context.Context, name string, args ...string) ([]byte, error)
	ExecuteRedacted(
		ctx context.Context, name string, args []string,
		secretsToRedact map[string]string,
	) ([]byte, error)
	ExecuteWithTimeout(
		ctx context.Context, name string, timeout time.Duration, logOutput bool, args ...string,
	) ([]byte, error)
	ExecuteWithTimeoutAndInput(
		ctx context.Context, name string, timeout time.Duration, logOutput bool, stdin string, args ...string,
	) ([]byte, error)
	ExecuteWithoutLog(ctx context.Context, name string, args ...string) ([]byte, error)
}

Command defines a set of behaviors for executing commands on a host.

func NewCommand

func NewCommand() Command

NewCommand returns a concrete client for executing OS-level commands.

type ExitError

type ExitError interface {
	error
	ExitCode() int
}

ExitError defines the methods that exec.ExitError implements. This enables unit testing and mocking of exit codes.

Jump to

Keyboard shortcuts

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