Back to / executor

Package executor

Latest Go to latest

The highest tagged major version is .

Published: Oct 2, 2018 | License: BSD-3-Clause | Module:



var ErrNotFound = errors.New("executable file not found in $PATH")

ErrNotFound is the error resulting if a path search failed to find an executable file.

type Action

type Action interface {
	Do(*Executor) error

Action interface is used for deferred actions that get performed during the build stage, unlike rules actions are NOT meant to be executed in parralel.

type Executor

type Executor struct {
	// contains filtered or unexported fields

Executor defines the envinroment in which a target will be built, it provide helper functions for shelling out without having to worry about stdout or stderr outputs.

func New

func New(ctx context.Context, ns namespace.Namespace) *Executor

New initializes and returns a new executor.Executor

func (*Executor) CombinedLog

func (e *Executor) CombinedLog() string

func (*Executor) Context

func (e *Executor) Context() context.Context

Context returns the context that's attached to the Executor

func (*Executor) Create

func (e *Executor) Create(name string) (*os.File, error)

Create creates and returns a new file with the given name in the namespace

func (*Executor) Exec

func (e *Executor) Exec(cmd string, env, args []string) error

Exec executes a command writing it's outputs to the context

func (*Executor) Log

func (e *Executor) Log() []fmt.Stringer

Log returns the logs

func (*Executor) Mkdir

func (e *Executor) Mkdir(name string) error

Mkdir creates a folder in the executor

func (*Executor) Open

func (e *Executor) Open(name string) (*os.File, error)

Open creates and returns a new file with the given name in the namespace

func (*Executor) OpenFile

func (e *Executor) OpenFile(name string, flag int, perm os.FileMode) (*os.File, error)

OpenFile creates and returns a new file with the given name, flags and mode in the namespace

func (*Executor) Printf

func (e *Executor) Printf(format string, v ...interface{})

Printf wraps sprintf for log items

func (*Executor) Println

func (e *Executor) Println(v ...interface{})

Println wraps sprintf for log items

func (*Executor) Run

func (e *Executor) Run(ctx context.Context, cmd string, args ...string) namespace.Cmd

Run executes a command writing it's outputs to the namespace

func (*Executor) RunCmds

func (e *Executor) RunCmds() []*Run

RunCmds commands returns the commands that ran

type Message

type Message string

Message defines a log Item in the message

func (Message) String

func (m Message) String() string

type Run

type Run struct {
	At     time.Time
	Cmd    string
	Args   []string
	Output []byte
	Env    []string
	Err    error

Run defines the execution step

func (*Run) String

func (r *Run) String() string

Package Files

  • env.go
  • executor.go
Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier