Documentation ¶
Overview ¶
Package process provides a helper for running and managing a subprocess.
It is intended for internal use by buildkite-agent only.
Index ¶
- func Cat(path string) (string, error)
- func FormatCommand(command string, args []string) string
- func GetPgid(pid int) (int, error)
- func Run(l logger.Logger, command string, arg ...string) (string, error)
- func SignalString(s syscall.Signal) string
- func StartPTY(c *exec.Cmd) (*os.File, error)
- type Buffer
- type Config
- type Prefixer
- type Process
- func (p *Process) Done() <-chan struct{}
- func (p *Process) Interrupt() error
- func (p *Process) Pid() int
- func (p *Process) Run(ctx context.Context) error
- func (p *Process) Started() <-chan struct{}
- func (p *Process) Terminate() error
- func (p *Process) WaitResult() error
- func (p *Process) WaitStatus() WaitStatus
- type Scanner
- type Signal
- type WaitStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatCommand ¶
FormatCommand formats a command amd arguments for human reading
func SignalString ¶ added in v3.21.0
SignalString returns the name of the given signal. For example, SignalString(syscall.Signal(15)) // "SIGTERM"
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer implements a concurrent-safe output buffer for processes.
func (*Buffer) ReadAndTruncate ¶ added in v3.45.0
ReadAndTruncate reads the unread contents of the buffer, and then truncates (empties) the buffer.
type Config ¶
type Config struct { PTY bool Timestamp bool Path string Args []string Env []string Stdin io.Reader Stdout io.Writer Stderr io.Writer Dir string InterruptSignal Signal }
Configuration for a Process
type Prefixer ¶
type Prefixer struct {
// contains filtered or unexported fields
}
Prefixer inserts prefixes generated by a callback before each line. To ensure any temporarily-buffered data is written out, be sure to call Flush when done.
func NewPrefixer ¶
NewPrefixer sets up a Prefixer outputting to an io.Writer w and reading prefixes from the callback f.
type Process ¶
type Process struct {
// contains filtered or unexported fields
}
Process is an operating system level process
func (*Process) Done ¶
func (p *Process) Done() <-chan struct{}
Done returns a channel that is closed when the process finishes
func (*Process) Started ¶
func (p *Process) Started() <-chan struct{}
Started returns a channel that is closed when the process is started
func (*Process) WaitResult ¶
WaitResult returns the raw error returned by Wait()
func (*Process) WaitStatus ¶
func (p *Process) WaitStatus() WaitStatus
WaitStatus returns the status of the Wait() call