executor

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: GPL-3.0 Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

package executor

It uses the mvdan.sh shell implementation in Go. injects a custom environment per execution

not all *nix* commands are available, should only be used for a limited number of scenarios

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(stdin io.Reader, stdout, stderr io.Writer) (*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

func (*DefaultExecutor) WithReset added in v1.6.3

func (e *DefaultExecutor) WithReset(doReset bool) *DefaultExecutor

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