executor

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2021 License: GPL-3.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsExitStatus

func IsExitStatus(err error) (uint8, bool)

IsExitStatus checks if given `err` is an exit status

Types

type DefaultExecutor

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

DefaultExecutor is a default executor used for jobs Uses `mvdan.cc/sh/v3/interp` under the hood

func NewDefaultExecutor

func NewDefaultExecutor() (*DefaultExecutor, error)

NewDefaultExecutor creates new default executor

func (*DefaultExecutor) Execute

func (e *DefaultExecutor) Execute(ctx context.Context, job *Job) ([]byte, error)

Execute executes given job with provided context Returns job output

type Executor

type Executor interface {
	Execute(context.Context, *Job) ([]byte, error)
}

Executor executes given job

type Job

type Job struct {
	Command string
	Dir     string
	Env     variables.Container
	Vars    variables.Container
	Timeout *time.Duration

	Stdout, Stderr io.Writer
	Stdin          io.Reader

	Next *Job
}

Job is a linked list of jobs to execute by Executor

func NewJobFromCommand

func NewJobFromCommand(command string) *Job

NewJobFromCommand creates new Job instance from given command

Jump to

Keyboard shortcuts

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