executor

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: Apache-2.0, MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

type Executor interface {
	// Execute executes the given command
	Execute(command string, args ...string) ([]byte, error)

	// LookPath searches for an executable named file in the directories named
	// by the PATH environment variable.
	LookPath(file string) (string, error)
}

Executor is an interface for executing commands.

type LocalExecutor

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

LocalExecutor is an Executor that runs commands locally.

func NewLocalExecutor

func NewLocalExecutor(logger *slog.Logger, options ...LocalExecutorOption) *LocalExecutor

NewLocalExecutor creates a new LocalExecutor with the given options.

func (*LocalExecutor) Execute

func (e *LocalExecutor) Execute(command string, args ...string) ([]byte, error)

func (*LocalExecutor) LookPath added in v0.3.0

func (e *LocalExecutor) LookPath(file string) (string, error)

type LocalExecutorOption

type LocalExecutorOption func(e *LocalExecutor)

LocalExecutorOption is an option for configuring a LocalExecutor.

func WithRedirect

func WithRedirect() LocalExecutorOption

WithRedirect is an option that configures the LocalExecutor to redirect the stdout and stderr of the commands to the stdout and stderr of the local process.

func WithRedirectTo

func WithRedirectTo(stdout, stderr io.Writer) LocalExecutorOption

WithRedirectTo is an option that configures the LocalExecutor to redirect the stdout and stderr of the commands to the given writers.

type WrappedExecuter added in v0.3.0

type WrappedExecuter interface {
	Execute(args ...string) ([]byte, error)
}

WrappedExecuter is an interface for executing commands using a specific command.

type WrappedLocalExecutor added in v0.3.0

type WrappedLocalExecutor struct {
	Executor
	// contains filtered or unexported fields
}

func NewLocalWrappedExecutor added in v0.3.0

func NewLocalWrappedExecutor(e Executor, command string) WrappedLocalExecutor

func (WrappedLocalExecutor) Execute added in v0.3.0

func (e WrappedLocalExecutor) Execute(args ...string) ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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