Documentation
¶
Index ¶
- Constants
- func FromError(err error) string
- func FromErrorCode(err error) int
- func ProcessesCount() int32
- type Command
- func (c *Command) Environ() []string
- func (c *Command) Exit() error
- func (c *Command) OneLine() (string, error)
- func (c *Command) Output() ([]byte, error)
- func (c *Command) Run() error
- func (c *Command) RunEx() error
- func (c *Command) Start() error
- func (c *Command) StderrPipe() (io.ReadCloser, error)
- func (c *Command) StdinPipe() (io.WriteCloser, error)
- func (c *Command) StdoutPipe() (io.ReadCloser, error)
- func (c *Command) String() string
- func (c *Command) UseTime() time.Duration
- func (c *Command) Wait() error
- type LimitStderr
- type RunOpts
- type Shepherd
Constants ¶
View Source
const ( STDERR_BUFFER_LIMIT = 8 * 1024 STDERR_BUFFER_GROUP = 512 )
View Source
const (
NoDir = ""
)
Variables ¶
This section is empty.
Functions ¶
func FromErrorCode ¶
func ProcessesCount ¶
func ProcessesCount() int32
ProcessesCount: Get the number of child processes of the default shepherd
Types ¶
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
func NewFromOptions ¶
Create an isolated process based on shepherd
func (*Command) StderrPipe ¶
func (c *Command) StderrPipe() (io.ReadCloser, error)
func (*Command) StdoutPipe ¶
func (c *Command) StdoutPipe() (io.ReadCloser, error)
type LimitStderr ¶
func NewStderr ¶
func NewStderr() *LimitStderr
func (*LimitStderr) Bytes ¶
func (w *LimitStderr) Bytes() []byte
type RunOpts ¶
type RunOpts struct {
Environ []string // As environ
ExtraEnv []string // append to env
RepoPath string // dir
Stderr io.Writer // stderr
Stdout io.Writer // stdout
Stdin io.Reader // stdin
Detached bool //Detached If true, the child process will not be terminated when the parent process ends
NoSetpgid bool
}
type Shepherd ¶ added in v0.17.0
type Shepherd interface {
// NewFromOptions: Create command with options
NewFromOptions(ctx context.Context, opt *RunOpts, name string, arg ...string) *Command
// New: Create a process with environment variable isolation
New(ctx context.Context, repoPath string, name string, arg ...string) *Command
// ProcessesCount: Get the number of child processes
ProcessesCount() int32
}
func NewShepherd ¶ added in v0.17.0
Click to show internal directories.
Click to hide internal directories.