executor

package
v0.2.80 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: BSD-3-Clause Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NotExistsFileError = errors.New("not_exists_file")
	NotInstalledError  = errors.New("not_installed")
)

Functions

func CreateRunnableFile

func CreateRunnableFile(dir string, cmd string, params ...string) (string, error)

CreateRunnableFile creates executable .sh or .bat file to run a command

func FindExecPath added in v0.2.49

func FindExecPath(name string) string

Types

type ConsoleProgram

type ConsoleProgram struct {
	// contains filtered or unexported fields
}

func NewConsoleProgram

func NewConsoleProgram(command string, args ...string) *ConsoleProgram

func NewConsoleProgramWithDir

func NewConsoleProgramWithDir(command string, dir string, args ...string) *ConsoleProgram

func NewConsoleProgramWithFile

func NewConsoleProgramWithFile(command string, filename string, args ...string) *ConsoleProgram

func (*ConsoleProgram) ErrorWriterAppend

func (instance *ConsoleProgram) ErrorWriterAppend(w io.Writer)

func (*ConsoleProgram) InputAppend

func (instance *ConsoleProgram) InputAppend(args ...string)

func (*ConsoleProgram) OutWriterAppend

func (instance *ConsoleProgram) OutWriterAppend(w io.Writer)

func (*ConsoleProgram) Prepare

func (instance *ConsoleProgram) Prepare(args ...string) (session *ConsoleProgramSession, err error)

func (*ConsoleProgram) Run

func (instance *ConsoleProgram) Run(args ...string) (*ConsoleProgramSession, error)

func (*ConsoleProgram) RunAsync

func (instance *ConsoleProgram) RunAsync(args ...string) (*ConsoleProgramSession, error)

func (*ConsoleProgram) RunWrapped

func (instance *ConsoleProgram) RunWrapped(args ...string) (*ConsoleProgramSession, error)

RunWrapped run program wrapped into runnable file launcher.

func (*ConsoleProgram) SetDir

func (instance *ConsoleProgram) SetDir(dir string)

func (*ConsoleProgram) SetFileName

func (instance *ConsoleProgram) SetFileName(filename string)

type ConsoleProgramSession

type ConsoleProgramSession struct {
	// contains filtered or unexported fields
}

func NewProgramSession

func NewProgramSession(command, uid string, inputs []string, outWriters, errWriters []io.Writer) *ConsoleProgramSession

func (*ConsoleProgramSession) Close

func (instance *ConsoleProgramSession) Close()

Close try to close gracefully sending CTRL+C command

func (*ConsoleProgramSession) GoString

func (instance *ConsoleProgramSession) GoString() string

func (*ConsoleProgramSession) Kill

func (instance *ConsoleProgramSession) Kill() (err error)

func (*ConsoleProgramSession) PidCurrent

func (instance *ConsoleProgramSession) PidCurrent() int

func (*ConsoleProgramSession) PidLatest

func (instance *ConsoleProgramSession) PidLatest() int

func (*ConsoleProgramSession) Run

func (instance *ConsoleProgramSession) Run(args ...string) (*ConsoleProgramSession, error)

func (*ConsoleProgramSession) RunAsync

func (instance *ConsoleProgramSession) RunAsync(args ...string) (*ConsoleProgramSession, error)

func (*ConsoleProgramSession) SetDir

func (instance *ConsoleProgramSession) SetDir(dir string)

func (*ConsoleProgramSession) SetFileName

func (instance *ConsoleProgramSession) SetFileName(filename string)

func (*ConsoleProgramSession) StdErr

func (instance *ConsoleProgramSession) StdErr() string

func (*ConsoleProgramSession) StdOut

func (instance *ConsoleProgramSession) StdOut() string

func (*ConsoleProgramSession) StdOutJson

func (instance *ConsoleProgramSession) StdOutJson() interface{}

func (*ConsoleProgramSession) String

func (instance *ConsoleProgramSession) String() string

func (*ConsoleProgramSession) Wait

func (instance *ConsoleProgramSession) Wait() (err error)

type Executor

type Executor struct {
	// contains filtered or unexported fields
}

func NewExecutor

func NewExecutor(cmd string) *Executor

func NewExecutorWithDir

func NewExecutorWithDir(cmd, execDir string) *Executor

func (*Executor) Close

func (instance *Executor) Close()

Close kill executable using os.Interrupt signal

func (*Executor) Elapsed

func (instance *Executor) Elapsed() int

func (*Executor) ErrorWriterAppend

func (instance *Executor) ErrorWriterAppend(w io.Writer)

func (*Executor) GoString

func (instance *Executor) GoString() string

func (*Executor) Inputs

func (instance *Executor) Inputs() []string

func (*Executor) InputsAppend

func (instance *Executor) InputsAppend(text string)

func (*Executor) IsKillable

func (instance *Executor) IsKillable() bool

func (*Executor) IsRunning

func (instance *Executor) IsRunning() bool

func (*Executor) Kill

func (instance *Executor) Kill() error

func (*Executor) OutWriterAppend

func (instance *Executor) OutWriterAppend(w io.Writer)

func (*Executor) PidCurrent

func (instance *Executor) PidCurrent() int

func (*Executor) PidLatest

func (instance *Executor) PidLatest() int

func (*Executor) Run

func (instance *Executor) Run(args ...string) error

func (*Executor) StdErr

func (instance *Executor) StdErr() string

func (*Executor) StdOut

func (instance *Executor) StdOut() string

func (*Executor) StdOutLines

func (instance *Executor) StdOutLines() []string

func (*Executor) StdOutMap

func (instance *Executor) StdOutMap() map[string]interface{}

func (*Executor) String

func (instance *Executor) String() string

func (*Executor) Wait

func (instance *Executor) Wait() error

Wait wait command terminated

Jump to

Keyboard shortcuts

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