Documentation ¶
Overview ¶
Package executor contains general purpose command executing objects.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IExecutor ¶
type IExecutor interface { Start(*model.WorkerConfig) (*model.Process, error) Processes() ([]OsProcess, error) IsPidRunning(pid int) (bool, error) Kill(pid int) error }
IExecutor is the interface type for ProcessExecutor.
func NewProcessExecutor ¶
NewProcessExecutor returns process executor
type OsProcess ¶
OsProcess represent the process information for the worker, such as pid and binary name
type ProcessExecutor ¶
type ProcessExecutor struct {
// contains filtered or unexported fields
}
ProcessExecutor is specially added for testing purposes
func (*ProcessExecutor) IsPidRunning ¶
func (exc *ProcessExecutor) IsPidRunning(pid int) (bool, error)
IsPidRunning returns true if process with pid is running
func (*ProcessExecutor) Kill ¶
func (exc *ProcessExecutor) Kill(pid int) error
func (*ProcessExecutor) Processes ¶
func (exc *ProcessExecutor) Processes() ([]OsProcess, error)
Processes returns running processes on the instance
func (*ProcessExecutor) Start ¶
func (exc *ProcessExecutor) Start(workerConfig *model.WorkerConfig) (*model.Process, error)
Start starts a list of shell commands in the given working directory. Returns process started, an exit code (0 if successfully launch, 1 if error launching process), and a set of errors. The errors need not be fatal - the output streams may still have data even though some errors are reported. For example, if the command got killed while executing, the streams will have whatever data was printed up to the kill point, and the errors will indicate that the process got terminated.