gexec

package
v0.0.0-...-33c3de2 Latest Latest
Warning

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

Go to latest
Published: May 8, 2025 License: MIT Imports: 16 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

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

func NewCommand

func NewCommand(cmd string) *Command

func (*Command) AfterExec

func (s *Command) AfterExec(f func(command *Command, cmd *exec.Cmd, err error)) *Command

func (*Command) AfterExited

func (s *Command) AfterExited(f func(command *Command, cmd *exec.Cmd, err error)) *Command

func (*Command) Args

func (s *Command) Args(args ...string) *Command

func (*Command) Async

func (s *Command) Async(async bool) *Command

Async create a goroutine to wait the command exited, the command be synchronized executed if current process exited, the child process will be exited

func (*Command) AsyncCallback

func (s *Command) AsyncCallback(asyncCallback func(cmd *Command, output string, err error)) *Command

func (*Command) BeforeExec

func (s *Command) BeforeExec(f func(command *Command, cmd *exec.Cmd)) *Command

func (*Command) Cmd

func (s *Command) Cmd() *exec.Cmd

func (*Command) Detach

func (s *Command) Detach(detach bool) *Command

Detach make subprocess detach form current process. If current process exited, the child process will not be exited.

Note: this feature only working in go version >=1.20

func (*Command) Env

func (s *Command) Env(env map[string]string) *Command

func (*Command) Exec

func (s *Command) Exec() (output string, e error)

Exec execute command on linux system.

func (*Command) ExecAsync

func (s *Command) ExecAsync() (e error)

ExecAsync async execute command on linux system.

func (*Command) Kill

func (s *Command) Kill()

func (*Command) Log

func (s *Command) Log(log gcore.Logger) *Command

func (*Command) Output

func (s *Command) Output(w io.Writer) *Command

func (*Command) StrictMode

func (s *Command) StrictMode(strictMode bool) *Command

func (*Command) TermType

func (s *Command) TermType(termType TermType) *Command

func (*Command) Timeout

func (s *Command) Timeout(timeout time.Duration) *Command

func (*Command) WorkDir

func (s *Command) WorkDir(workDir string) *Command

type TermType

type TermType string
const (
	TermXterm         TermType = "xterm"
	TermXterm256Color TermType = "xterm-256color"
	TermVt100         TermType = "vt100"
	TermRxvt          TermType = "rxvt"
	TermGnome         TermType = "gnome-terminal"
	TermKonsole       TermType = "konsole"
	TermTmux          TermType = "tmux"
	TermScreen        TermType = "screen"
	TermAnsi          TermType = "ansi"
	TermNull          TermType = ""
)

Jump to

Keyboard shortcuts

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