cgexec

package
v1.9.5 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeCommand

func MakeCommand(workingDir string, path string, args []string, ctx IContext) *exec.Cmd

func RunCommand

func RunCommand(cmd ICommand, ctx IContext) error

Types

type Command

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

func NewCommand

func NewCommand(osCmd *exec.Cmd) *Command

func (Command) CombinedOutput

func (cmd Command) CombinedOutput() ([]byte, error)

func (Command) GetArgs

func (cmd Command) GetArgs() []string

func (Command) GetDir

func (cmd Command) GetDir() string

func (Command) GetProcess

func (cmd Command) GetProcess() *os.Process

func (Command) GetStdErr added in v1.9.0

func (cmd Command) GetStdErr() *bytes.Buffer

func (Command) GetStdOut added in v1.9.0

func (cmd Command) GetStdOut() *bytes.Buffer

func (Command) SetStderr

func (cmd Command) SetStderr(stderr *bytes.Buffer)

func (Command) SetStdout

func (cmd Command) SetStdout(stdout *bytes.Buffer)

func (Command) Signal

func (cmd Command) Signal(process *os.Process, signal os.Signal) error

func (Command) Start

func (cmd Command) Start() error

func (Command) Wait

func (cmd Command) Wait() error

type Context

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

func NewContext

func NewContext(timer int) (Context, context.CancelFunc)

func (Context) Context

func (c Context) Context() context.Context

func (Context) Done

func (c Context) Done() <-chan struct{}

type ICommand

type ICommand interface {
	CombinedOutput() ([]byte, error)
	Start() error
	Wait() error
	GetProcess() *os.Process
	SetStderr(*bytes.Buffer)
	SetStdout(*bytes.Buffer)
	GetArgs() []string
	GetDir() string
	Signal(process *os.Process, signal os.Signal) error
	GetStdOut() *bytes.Buffer
	GetStdErr() *bytes.Buffer
}

type IContext

type IContext interface {
	Context() context.Context
	Done() <-chan struct{}
}

Jump to

Keyboard shortcuts

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