executor

package
v0.0.0-...-5001955 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(args []string, opts ...Option) error

func NewExecutionError

func NewExecutionError(err error, cmd []string, code int, stdout bytes.Buffer, stderr bytes.Buffer) error

func RequestSudo

func RequestSudo(prompt string) error

Types

type ExecutionError

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

func (ExecutionError) Cmd

func (e ExecutionError) Cmd() string

func (ExecutionError) Code

func (e ExecutionError) Code() int

func (ExecutionError) Error

func (e ExecutionError) Error() string

func (ExecutionError) Stderr

func (e ExecutionError) Stderr() *bufio.Reader

func (ExecutionError) Stdout

func (e ExecutionError) Stdout() *bufio.Reader

type Executor

type Executor interface {
	Execute([]string, ...Option) error
}

type Option

type Option func(*exec.Cmd) error

func WithEnv

func WithEnv(env map[string]string) Option

func WithEnviron

func WithEnviron(environ []string) Option

func WithStderr

func WithStderr(w io.Writer) Option

func WithStdin

func WithStdin(r io.Reader) Option

func WithStdout

func WithStdout(w io.Writer) Option

func WithSudo

func WithSudo(fun func() error) Option

Jump to

Keyboard shortcuts

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