executioner

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseCmd

type BaseCmd struct {
	*exec.Cmd
}

BaseCmd implements basic functions of cmd

func (*BaseCmd) GetArgs

func (b *BaseCmd) GetArgs() []string

GetArgs return the Cmd's Args

func (*BaseCmd) GetDir

func (b *BaseCmd) GetDir() string

GetDir return the Cmd's Dir

func (*BaseCmd) GetEnv

func (b *BaseCmd) GetEnv() []string

GetEnv return the Cmd's Env

func (*BaseCmd) GetExtraFiles

func (b *BaseCmd) GetExtraFiles() []*os.File

GetExtraFiles return the Cmd's ExtraFiles

func (*BaseCmd) GetPath

func (b *BaseCmd) GetPath() string

GetPath return the Cmd's Path

func (*BaseCmd) GetProcess

func (b *BaseCmd) GetProcess() *os.Process

GetProcess return the Cmd's Process

func (*BaseCmd) GetProcessState

func (b *BaseCmd) GetProcessState() *os.ProcessState

GetProcessState return the Cmd's ProcessState

func (*BaseCmd) GetStderr

func (b *BaseCmd) GetStderr() io.Writer

GetStderr return the Cmd's Stderr

func (*BaseCmd) GetStdin

func (b *BaseCmd) GetStdin() io.Reader

GetStdin return the Cmd's Stdin

func (*BaseCmd) GetStdout

func (b *BaseCmd) GetStdout() io.Writer

GetStdout return the Cmd's Stdout

func (*BaseCmd) GetSysProcAttr

func (b *BaseCmd) GetSysProcAttr() *syscall.SysProcAttr

GetSysProcAttr return the Cmd's SysProcAttr

func (*BaseCmd) SetArgs

func (b *BaseCmd) SetArgs(value []string)

SetArgs set Command's Args

func (*BaseCmd) SetDir

func (b *BaseCmd) SetDir(value string)

SetDir set Command's Dir

func (*BaseCmd) SetEnv

func (b *BaseCmd) SetEnv(value []string)

SetEnv set Command's Env

func (*BaseCmd) SetExtraFiles

func (b *BaseCmd) SetExtraFiles(value []*os.File)

SetExtraFiles set Command's ExtraFiles

func (*BaseCmd) SetPath

func (b *BaseCmd) SetPath(value string)

SetPath set Command's Path

func (*BaseCmd) SetStderr

func (b *BaseCmd) SetStderr(value io.Writer)

SetStderr set Command's Stderr

func (*BaseCmd) SetStdin

func (b *BaseCmd) SetStdin(value io.Reader)

SetStdin set Command's Stdin

func (*BaseCmd) SetStdout

func (b *BaseCmd) SetStdout(value io.Writer)

SetStdout set Command's Stdout

func (*BaseCmd) SetSysProcAttr

func (b *BaseCmd) SetSysProcAttr(value *syscall.SysProcAttr)

SetSysProcAttr set Command's SysProcAttr

type Cmd

type Cmd interface {
	SetPath(string)
	SetArgs([]string)
	SetEnv([]string)
	SetDir(string)
	SetStdin(io.Reader)
	SetStdout(io.Writer)
	SetStderr(io.Writer)
	SetExtraFiles([]*os.File)
	SetSysProcAttr(*syscall.SysProcAttr)

	GetPath() string
	GetArgs() []string
	GetEnv() []string
	GetDir() string
	GetStdin() io.Reader
	GetStdout() io.Writer
	GetStderr() io.Writer
	GetExtraFiles() []*os.File
	GetSysProcAttr() *syscall.SysProcAttr
	GetProcess() *os.Process
	GetProcessState() *os.ProcessState

	CombinedOutput() ([]byte, error)
	Output() ([]byte, error)
	Run() error
	Start() error
	StderrPipe() (io.ReadCloser, error)
	StdinPipe() (io.WriteCloser, error)
	StdoutPipe() (io.ReadCloser, error)
	Wait() error
}

Cmd represents an external command being prepared or run

type Exec

type Exec interface {
	Command(name string, arg ...string) Cmd
	CommandContext(ctx context.Context, name string, arg ...string) Cmd
}

Exec runs external commands.

func NewOSExec

func NewOSExec() Exec

NewOSExec create new OsExec instance

type MemCmd

type MemCmd struct {
	*BaseCmd
	MemExec
	Context context.Context
}

MemCmd implements Cmd using memory

func (*MemCmd) CombinedOutput

func (m *MemCmd) CombinedOutput() ([]byte, error)

CombinedOutput implements CombinedOutput of Cmd

func (*MemCmd) Output

func (m *MemCmd) Output() ([]byte, error)

Output implements Output of Cmd

func (*MemCmd) Run

func (m *MemCmd) Run() error

Run implements Run of Cmd

func (*MemCmd) Start

func (m *MemCmd) Start() error

Start implements Start of Cmd

func (*MemCmd) StderrPipe

func (m *MemCmd) StderrPipe() (io.ReadCloser, error)

StderrPipe implements StderrPipe of Cmd

func (*MemCmd) StdinPipe

func (m *MemCmd) StdinPipe() (io.WriteCloser, error)

StdinPipe implements StdinPipe of Cmd

func (*MemCmd) StdoutPipe

func (m *MemCmd) StdoutPipe() (io.ReadCloser, error)

StdoutPipe implements StdoutPipe of Cmd

func (*MemCmd) Wait

func (m *MemCmd) Wait() error

Wait implements Wait of Cmd

type MemExec

type MemExec struct {
	CombinedOutputCallback func(*MemCmd) ([]byte, error)
	OutputCallback         func(*MemCmd) ([]byte, error)
	RunCallback            func(*MemCmd) error
	StartCallback          func(*MemCmd) error
	StderrPipeCallback     func(*MemCmd) (io.ReadCloser, error)
	StdinPipeCallback      func(*MemCmd) (io.WriteCloser, error)
	StdoutPipeCallback     func(*MemCmd) (io.ReadCloser, error)
	WaitCallback           func(*MemCmd) error
}

MemExec implements Exec using callbacks

func NewMemExec

func NewMemExec() *MemExec

NewMemExec not yet defined

func (*MemExec) Command

func (m *MemExec) Command(name string, arg ...string) Cmd

Command returns the Cmd struct to execute the named program with the given arguments

func (*MemExec) CommandContext

func (m *MemExec) CommandContext(ctx context.Context, name string, arg ...string) Cmd

CommandContext create command with context

type OsCmd

type OsCmd struct {
	BaseCmd
}

OsCmd implements cmd from os package

type OsExec

type OsExec struct{}

OsExec implements exec from os package

func (*OsExec) Command

func (*OsExec) Command(name string, arg ...string) Cmd

Command returns the Cmd struct to execute the named program with the given arguments

func (*OsExec) CommandContext

func (*OsExec) CommandContext(ctx context.Context, name string, arg ...string) Cmd

CommandContext returns Cmd with context

Jump to

Keyboard shortcuts

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