commandutil

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KilledExitCode is a special exit code value used by the "os/exec" package
	// when a process is killed.
	KilledExitCode = -1
	// NoExitCode indicates a missing exit code value, usually because the process
	// never started, or its actual exit code could not be determined because of an
	// error.
	NoExitCode = -2
)

Variables

View Source
var (
	DebugStreamCommandOutputs = true
)

Functions

func EnvStringList

func EnvStringList(command *repb.Command) []string

EnvStringList returns the command's environment variables as a list of string assignments. (Example: {"KEY1=VAL1", "KEY2=VAL2"})

func ErrorResult

func ErrorResult(err error) *interfaces.CommandResult

func ExitCode

func ExitCode(ctx context.Context, cmd *exec.Cmd, err error) (int, error)

exitCode returns the exit code from the given command, based on the error returned. If the command could not be started or did not exit cleanly, an error is returned.

func RetryIfTextFileBusy

func RetryIfTextFileBusy(fn func() error) error

RetryIfTextFileBusy runs a function, retrying "text file busy" errors up to 3 times. This is a workaround for https://github.com/golang/go/issues/22315

func Run

func Run(ctx context.Context, command *repb.Command, workDir string, stdin io.Reader, stdout io.Writer) *interfaces.CommandResult

Run a command, retrying "text file busy" errors.

Types

This section is empty.

Jump to

Keyboard shortcuts

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