exec

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package exec wraps os/exec to add a little error sanitization and standardization around process return codes and a channel-based cancel mechanism

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CmdRunResult

type CmdRunResult struct {
	Stdout   string
	Stderr   string
	ExitCode int
	Error    error
	Finished bool
}

func NewCmdRunResultWithErr

func NewCmdRunResultWithErr(err error) CmdRunResult

func (*CmdRunResult) AttachErrorf

func (r *CmdRunResult) AttachErrorf(msg string, err error)

func (CmdRunResult) ErrorStr

func (r CmdRunResult) ErrorStr() string

func (CmdRunResult) IsEmpty added in v0.30.3

func (r CmdRunResult) IsEmpty() bool

func (CmdRunResult) WithFriendlyYAMLStrings

func (r CmdRunResult) WithFriendlyYAMLStrings() CmdRunResult

type CmdRunner added in v0.37.0

type CmdRunner interface {
	Run(*exec.Cmd) error
	RunWithCancel(cmd *exec.Cmd, cancelCh chan struct{}) error
}

CmdRunner allows to run commands on the OS. All commands running within kapp-controller should happen through an instance of this interface so that they can be intercepted and potentially modified in kctrl when running kapp-controller locally.

type Flag

type Flag struct {
	Name  string // e.g. --name
	Value string
}

func NewFlagFromString

func NewFlagFromString(str string) (Flag, error)

type FlagSet added in v0.13.0

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

func NewFlagSet added in v0.13.0

func NewFlagSet(optss ...[]string) FlagSet

func (FlagSet) Includes added in v0.13.0

func (s FlagSet) Includes(name string) bool

type PlainCmdRunner added in v0.37.0

type PlainCmdRunner struct{}

PlainCmdRunner implements CmdRunner interface by simply running exec.Cmd.

func NewPlainCmdRunner added in v0.37.0

func NewPlainCmdRunner() PlainCmdRunner

NewPlainCmdRunner returns a new PlainCmdRunner.

func (PlainCmdRunner) Run added in v0.37.0

func (PlainCmdRunner) Run(cmd *exec.Cmd) error

Run executes exec.Cmd.

func (PlainCmdRunner) RunWithCancel added in v0.37.0

func (PlainCmdRunner) RunWithCancel(cmd *exec.Cmd, cancelCh chan struct{}) error

RunWithCancel executes exec.Cmd. Kills execution immediately if value is read from cancelCh.

Jump to

Keyboard shortcuts

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