exec

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CmdParam

type CmdParam struct {
	Cmd          string
	Params       []string
	RawCmdString string
}

type Context

type Context struct {
	Ctx          context.Context
	StdoutWriter io.Writer
	StderrWriter io.Writer
	WorkingDir   string
	User         string
	Path         string
	Envs         conv.KeyValues
	Cmds         []string
	Pids         []int
	Shell        string
}

func (*Context) Copy

func (c *Context) Copy() Context

type OSApi

type OSApi struct {
}

func (OSApi) Run

func (oe OSApi) Run(cmd *exec.Cmd) error

func (OSApi) SetUser

func (oe OSApi) SetUser(userName, path string, cmd *exec.Cmd) error

type RunError

type RunError struct {
	Err      error
	ExitCode int
}

func (RunError) Error

func (re RunError) Error() string

type Runner

type Runner interface {
	Run(execContext *Context) error
}

type RunnerMock

type RunnerMock struct {
	GivenExecContexts []*Context
	ErrToReturn       error
	RunOutputCallback func(stdOutWriter, stdErrWriter io.Writer)
}

func (*RunnerMock) Run

func (rm *RunnerMock) Run(execContext *Context) error

type ShellParam

type ShellParam struct {
	ShellName      string
	ShellPath      string
	ShellParams    []string
	RawShellString string
}

type SystemAPI

type SystemAPI interface {
	Run(cmd *exec.Cmd) error
	SetUser(userName, path string, cmd *exec.Cmd) error
}

type SystemAPIMock

type SystemAPIMock struct {
	StdOutText string
	StdErrText string
	Cmds       []*exec.Cmd
	ErrToGive  error

	UserNameInput      string
	UserNamePathInput  string
	UserSetErrToReturn error
	Callback           func(cmd *exec.Cmd) error
}

func (*SystemAPIMock) Run

func (oem *SystemAPIMock) Run(cmd *exec.Cmd) error

func (*SystemAPIMock) SetUser

func (oem *SystemAPIMock) SetUser(userName, path string, cmd *exec.Cmd) error

type SystemRunner

type SystemRunner struct {
	SystemAPI SystemAPI
}

func (SystemRunner) Run

func (sr SystemRunner) Run(execContext *Context) error

Jump to

Keyboard shortcuts

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