exec

package
v0.4.0-beta.29 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddEnvironmentCapture

func AddEnvironmentCapture(sourceLang string, script *scripts.Script, captures []string)

func ChangeCommentsToSpinnerCommands

func ChangeCommentsToSpinnerCommands(sourceLang string, source []byte) []byte

Types

type ErrorDetails

type ErrorDetails struct {
	Error       string
	ErrorSource *ErrorSource
}

func ParseError

func ParseError(script *scripts.Script, stdout string) *ErrorDetails

func (*ErrorDetails) String

func (e *ErrorDetails) String(colors aurora.Aurora) string

type ErrorSource

type ErrorSource struct {
	Source []byte
	Line   int
}

type ExecutionIntent

type ExecutionIntent struct {
	Via            string
	Script         []byte
	ReplaceProcess bool
	StartedChan    chan interface{}
	// contains filtered or unexported fields
}

func NewExecution

func NewExecution(via string, script []byte, cwd string) (*ExecutionIntent, error)

func (*ExecutionIntent) AddModifier

func (*ExecutionIntent) Execute

func (i *ExecutionIntent) Execute() (*ExecutionResult, error)

func (*ExecutionIntent) ImportEnv

func (i *ExecutionIntent) ImportEnv(env map[string]string)

type ExecutionResult

type ExecutionResult struct {
	Scripts  *scripts.ScriptManager
	Output   []byte
	ExitCode int
	Env      map[string]string
}

type Process

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

func NewProcess

func NewProcess(cmd *exec.Cmd) *Process

func (*Process) Start

func (p *Process) Start() (*io.PipeReader, *io.PipeReader, error)

func (*Process) Wait

func (p *Process) Wait() error

type RundownCommandHandler

type RundownCommandHandler interface {
	SetSpinnerTitle(title string)
	SetEnvironmentVariable(name string, value string)
}

type Runner

type Runner struct {
	Script *scripts.Script
	// contains filtered or unexported fields
}

func NewRunner

func NewRunner() *Runner

func (*Runner) ExecuteAndReplace

func (r *Runner) ExecuteAndReplace() error

Executes the script, replacing the current process.

func (*Runner) ImportEnv

func (r *Runner) ImportEnv(env map[string]string)

func (*Runner) Prepare

func (r *Runner) Prepare() (*Running, error)

func (*Runner) RunReplacingProcess

func (r *Runner) RunReplacingProcess() error

func (*Runner) SetScript

func (r *Runner) SetScript(binaryPath string, language string, source []byte) (*scripts.Script, error)

type Running

type Running struct {
	Runner *Runner
	Stdout io.ReadCloser

	StderrOutput []byte
	Stderr       io.ReadCloser
	// contains filtered or unexported fields
}

func (*Running) Start

func (r *Running) Start() error

func (*Running) Wait

func (r *Running) Wait() (int, time.Duration, error)

type StdinReader

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

Reading directly from STDIN when executing multiple processes creates issues, as STDIN read is blocking and you can't cancel it. Instead, this is the only place we read from STDIN, and we direct the byte stream to the io.Reader returned by Claim().

func NewStdinReader

func NewStdinReader() *StdinReader

func (*StdinReader) Claim

func (r *StdinReader) Claim() io.ReadCloser

func (*StdinReader) Stop

func (r *StdinReader) Stop()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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