scriptrunner

package
v0.169.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CmdOptions added in v0.94.3

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

type Config

type Config struct {
	Name       string
	Executable string
	ScriptArgs []string
	// ScriptEnv is the environment variables that are always passed to the script.
	ScriptEnv []string
	// ScriptEnv are environment variables that are only set on the first script run.
	FirstRunEnv   []string
	AbsWorkingDir string
	Logger        *zap.Logger
	Output        *OutputConfig
}

type OutputConfig added in v0.166.0

type OutputConfig struct {
	Stdout io.Writer
	Stderr io.Writer
	Pipe   func(line string) string
}

OutputConfig configures the script output. Stdout and Stderr default to os.Stdout/os.Stderr, even if OutputConfig is nil. Pipe is an optional function that transforms each output line before printing it.

type ScriptRunner

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

func NewScriptRunner

func NewScriptRunner(config *Config) *ScriptRunner

func (*ScriptRunner) Error added in v0.112.0

func (b *ScriptRunner) Error() error

func (*ScriptRunner) ExitCode added in v0.100.0

func (b *ScriptRunner) ExitCode() int

func (*ScriptRunner) Run

func (b *ScriptRunner) Run(ctx context.Context) chan struct{}

func (*ScriptRunner) Stop

func (b *ScriptRunner) Stop() error

func (*ScriptRunner) Successful added in v0.100.0

func (b *ScriptRunner) Successful() bool

Successful returns true if the script exited with <= 0 and without an error. This method should only be called after the script is done.

Jump to

Keyboard shortcuts

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