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 ¶
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 ¶
WithExecFunc provides customized exec behavior for executorImp
func WithLogger ¶
func WithLogger(logger *zap.SugaredLogger) Option
WithLogger overrides the default noop logger
Click to show internal directories.
Click to hide internal directories.