Documentation ¶
Overview ¶
Package zfscmd provides a wrapper around packate os/exec. Functionality provided by the wrapper: - logging start and end of command execution - status report of active commands - prometheus metrics of runtimes
Index ¶
- func RegisterMetrics(r prometheus.Registerer)
- func WithJobID(ctx context.Context, jobID string) context.Context
- type ActiveCommand
- type Cmd
- func (c *Cmd) CombinedOutput() (o []byte, err error)
- func (c *Cmd) Output() (o []byte, err error)
- func (c *Cmd) Process() *os.Process
- func (c *Cmd) Runtime() time.Duration
- func (c *Cmd) SetStdio(stdio Stdio)
- func (c *Cmd) Start() (err error)
- func (c *Cmd) StdoutPipeWithErrorBuf() (p io.ReadCloser, errBuf *circlog.CircularLog, err error)
- func (c *Cmd) String() string
- func (c *Cmd) Wait() (err error)
- type Logger
- type Report
- type Stdio
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterMetrics ¶
func RegisterMetrics(r prometheus.Registerer)
Types ¶
type Cmd ¶
type Cmd struct {
// contains filtered or unexported fields
}
func (*Cmd) CombinedOutput ¶
err.(*exec.ExitError).Stderr will NOT be set
func (*Cmd) Process ¶
Get the underlying os.Process.
Only call this method after a successful call to .Start().
func (*Cmd) Start ¶
Start the command.
This creates a new trace.WithTask as a child task of the ctx passed to CommandContext. If the process is successfully started (err == nil), it is the CALLER'S RESPONSIBILITY to ensure that the spawned process does not outlive the ctx's trace.Task.
If this method returns an error, the Cmd instance is invalid. Start must not be called repeatedly.
func (*Cmd) StdoutPipeWithErrorBuf ¶
func (c *Cmd) StdoutPipeWithErrorBuf() (p io.ReadCloser, errBuf *circlog.CircularLog, err error)
Careful: err.(*exec.ExitError).Stderr will not be set, even if you don't open an StderrPipe
type Report ¶
type Report struct {
Active []ActiveCommand
}