osexec

package
v2.36.0-1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command

func Command(ctx context.Context, name string, arg ...string) *exec.Cmd

Types

type Cmd

type Cmd = exec.Cmd

type Executor

type Executor struct{}

func New

func New() *Executor

func (*Executor) Exec

func (e *Executor) Exec(cmd *exec.Cmd) (int, error)

func (*Executor) ExecAndOutputWhenFailure

func (e *Executor) ExecAndOutputWhenFailure(cmd *exec.Cmd) (int, error)

execAndOutputWhenFailure executes a command, and outputs the command output to standard error only when the command failed.

func (*Executor) ExecStderr

func (e *Executor) ExecStderr(cmd *exec.Cmd) (int, error)

func (*Executor) ExecStderrAndGetCombinedOutput

func (e *Executor) ExecStderrAndGetCombinedOutput(cmd *exec.Cmd) (string, int, error)

func (*Executor) ExecXSys

func (e *Executor) ExecXSys(exePath string, args ...string) error

type Mock

type Mock struct {
	ExitCode int
	Err      error
	Output   string
}

func (*Mock) Exec

func (e *Mock) Exec(cmd *Cmd) (int, error)

func (*Mock) ExecAndOutputWhenFailure

func (e *Mock) ExecAndOutputWhenFailure(cmd *Cmd) (int, error)

func (*Mock) ExecStderr

func (e *Mock) ExecStderr(cmd *Cmd) (int, error)

func (*Mock) ExecStderrAndGetCombinedOutput

func (e *Mock) ExecStderrAndGetCombinedOutput(cmd *Cmd) (string, int, error)

func (*Mock) ExecXSys

func (e *Mock) ExecXSys(exePath string, args ...string) error

Jump to

Keyboard shortcuts

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