command

package
v1.230.4 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RelaxedURLRegEx = `` /* 200-byte string literal not displayed */
)

Variables

View Source
var ExecCommand = exec.Command

ExecCommand defines how to execute os commands

Functions

This section is empty.

Types

type Command

type Command struct {
	ErrorCategoryMapping map[string][]string
	URLReportFileName    string
	// contains filtered or unexported fields
}

Command defines the information required for executing a call to any executable

func (*Command) AppendEnv

func (c *Command) AppendEnv(env []string)

AppendEnv appends environment variables to be used for execution

func (*Command) GetExitCode

func (c *Command) GetExitCode() int

GetExitCode allows to retrieve the exit code of a command execution

func (*Command) GetOsEnv

func (c *Command) GetOsEnv() []string

func (*Command) GetStderr

func (c *Command) GetStderr() io.Writer

GetStderr Retursn the writer for stderr

func (*Command) GetStdout

func (c *Command) GetStdout() io.Writer

GetStdout Returns the writer for stdout

func (*Command) RunExecutable

func (c *Command) RunExecutable(executable string, params ...string) error

RunExecutable runs the specified executable with parameters !! While the cmd.Env is applied during command execution, it is NOT involved when the actual executable is resolved.

Thus the executable needs to be on the PATH of the current process and it is not sufficient to alter the PATH on cmd.Env.

func (*Command) RunExecutableInBackground

func (c *Command) RunExecutableInBackground(executable string, params ...string) (Execution, error)

RunExecutableInBackground runs the specified executable with parameters in the background non blocking !! While the cmd.Env is applied during command execution, it is NOT involved when the actual executable is resolved.

Thus the executable needs to be on the PATH of the current process and it is not sufficient to alter the PATH on cmd.Env.

func (*Command) RunShell

func (c *Command) RunShell(shell, script string) error

RunShell runs the specified command on the shell

func (*Command) SetDir

func (c *Command) SetDir(dir string)

SetDir sets the working directory for the execution

func (*Command) SetEnv

func (c *Command) SetEnv(env []string)

SetEnv sets explicit environment variables to be used for execution

func (*Command) Stderr

func (c *Command) Stderr(stderr io.Writer)

Stderr ..

func (*Command) Stdin

func (c *Command) Stdin(stdin io.Reader)

Stdin ..

func (*Command) Stdout

func (c *Command) Stdout(stdout io.Writer)

Stdout ..

type ExecRunner

type ExecRunner interface {
	RunExecutable(executable string, params ...string) error
	RunExecutableInBackground(executable string, params ...string) (Execution, error)
	// contains filtered or unexported methods
}

ExecRunner mock for intercepting calls to executables

type Execution

type Execution interface {
	Kill() error
	Wait() error
}

Execution references a background process which is started by RunExecutableInBackground

type ShellRunner

type ShellRunner interface {
	RunShell(shell string, command string) error
	// contains filtered or unexported methods
}

ShellRunner mock for intercepting shell calls

Jump to

Keyboard shortcuts

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