Help us shape the future of Go! Take the 2026 Go Developer Survey

executor

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Options(
	fx.Supply(
		fx.Annotate(NewExecutor(
			WithExecFunc(func(cmd *exec.Cmd) error { return cmd.Run() }),
		), fx.As(new(Executor))),
	),
)

Module provides a module to inject using fx.

Functions

This section is empty.

Types

type Executor

type Executor interface {

	// RunCommand - logs and and executes the Cmd specified
	RunCommand(cmd *exec.Cmd, env []string) error
	// Run - logs and and executes the Cmd specified overriding its Stdout/Stderr to return their content
	Run(cmd *exec.Cmd) (stdout string, stderr string, exitCode int, err error)
}

Executor wraps the execution of "os/exec".Cmd's to allow adding logs/metrics to each exec and makes it easier to test.

func NewExecutor

func NewExecutor(opts ...Option) Executor

NewExecutor - creates a new executorImp with logger at the level specified and a default executor function

type Option

type Option func(*executorImp)

Option defines options to customize executorImp's behavior

func WithExecFunc

func WithExecFunc(execFunc func(e *exec.Cmd) error) Option

WithExecFunc provides customized exec behavior for executorImp

func WithLogger

func WithLogger(logger *zap.SugaredLogger) Option

WithLogger overrides the default noop logger

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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