exec

package
v0.6.43 Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: AGPL-3.0, Apache-2.0, MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalyzerOption

type AnalyzerOption func(*analyzerConfig)

AnalyzerOption is a functional option for configuring an OutputAnalyzer.

func StderrCheckForProvider

func StderrCheckForProvider(provider console.StackType) AnalyzerOption

StderrCheckForProvider returns an AnalyzerOption that enables stderr checking only for providers where stderr reliably indicates errors (e.g. Terraform), and disables it for providers that write non-error output to stderr (e.g. Ansible).

func WithStderrCheck

func WithStderrCheck(check bool) AnalyzerOption

WithStderrCheck enables or disables treating stderr output as an error.

type Error

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

func (Error) ToError

func (in Error) ToError() error

type Errors

type Errors []Error

func (Errors) ToErrors

func (in Errors) ToErrors() []error

type Executable

type Executable interface {
	ID() string
	Run(ctx context.Context) error
	Start(ctx context.Context) (WaitFn, error)
	RunWithOutput(ctx context.Context) ([]byte, error)
	RunStream(ctx context.Context, cb func([]byte)) error
	Command() string
}

func NewExecutable

func NewExecutable(command string, options ...Option) Executable

type ExecutionStrategy

type ExecutionStrategy string

ExecutionStrategy defines how executables queue should be processed.

const (
	ExecutionStrategyParallel ExecutionStrategy = "parallel"
	ExecutionStrategyOrdered  ExecutionStrategy = "ordered"
)

type Executor

type Executor interface {
	Start(ctx context.Context) error
	Add(executable Executable) error
}

func NewExecutor

func NewExecutor(errChan chan error, finishedChan chan struct{}, options ...ExecutorOption) Executor

type ExecutorOption

type ExecutorOption func(*executor)

func WithExecutionStrategy

func WithExecutionStrategy(strategy ExecutionStrategy) ExecutorOption

func WithPostRunFunc

func WithPostRunFunc(fn func(string, error)) ExecutorOption

func WithPreRunFunc

func WithPreRunFunc(fn func(string)) ExecutorOption

type Option

type Option func(*executable)

func WithArgs

func WithArgs(args []string) Option

func WithDir

func WithDir(workingDirectory string) Option

func WithEnv

func WithEnv(env []string) Option

func WithHook

func WithHook(lifecycle v1.Lifecycle, fn v1.HookFunction) Option

func WithID

func WithID(id string) Option

func WithOutputAnalyzer

func WithOutputAnalyzer(heuristics []OutputAnalyzerHeuristic, opts ...AnalyzerOption) Option

func WithOutputSinks

func WithOutputSinks(sinks ...io.WriteCloser) Option

func WithTimeout

func WithTimeout(timeout time.Duration) Option

type OutputAnalyzer

type OutputAnalyzer interface {
	Stdout() io.Writer
	Stderr() io.Writer

	// Detect scans the output for potential errors.
	// It uses a custom heuristics to detect issues.
	// It can result in a false positives.
	//
	// Note: Make sure that it is executed after Write
	//		 has finished to ensure proper detection.
	Detect() []error
}

OutputAnalyzer captures the command output and attempts to detect potential errors.

func NewOutputAnalyzer

func NewOutputAnalyzer(heuristics []OutputAnalyzerHeuristic, opts ...AnalyzerOption) OutputAnalyzer

type OutputAnalyzerHeuristic

type OutputAnalyzerHeuristic interface {
	Detect(input *bufio.Scanner) Errors
}

func NewKeywordDetector

func NewKeywordDetector() OutputAnalyzerHeuristic

type WaitFn

type WaitFn func() error

Jump to

Keyboard shortcuts

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