Documentation ¶
Overview ¶
Package srvrun contains various ways to run, or pretend to run, services.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DryRunner ¶
DryRunner is a runner that just outputs all commands to be run to itself.
func (DryRunner) WithStderr ¶
WithStderr just returns the same runner, ignoring the override.
type ExecOption ¶
type ExecOption func(*ExecRunner)
ExecOption is the type of options used when constructing a ExecRunner.
func ExecOptions ¶
func ExecOptions(os ...ExecOption) ExecOption
ExecOptions applies each option in os.
func StderrTo ¶
func StderrTo(w io.Writer) ExecOption
StderrTo redirects standard error of any commands run by the runner to w.
func WithGrace ¶
func WithGrace(d time.Duration) ExecOption
WithGrace sets a timeout grace period of d.
If an ExecRunner's context closes and it has a timeout grace period, and the OS supports it, it will SIGTERM the program, wait d, and then SIGKILL.
type ExecRunner ¶
type ExecRunner struct {
// contains filtered or unexported fields
}
ExecRunner represents runs of services using exec.
func NewExecRunner ¶
func NewExecRunner(os ...ExecOption) *ExecRunner
NewExecRunner constructs an exec-based runner using the options in os.
func (ExecRunner) WithGrace ¶
func (e ExecRunner) WithGrace(d time.Duration) service.Runner
WithGrace returns a new ExecRunner with the timeout grace period set as d.
func (ExecRunner) WithStderr ¶
func (e ExecRunner) WithStderr(w io.Writer) service.Runner
WithStderr returns a new ExecRunner with standard error rerouted to w.
func (ExecRunner) WithStdout ¶
func (e ExecRunner) WithStdout(w io.Writer) service.Runner
WithStdout returns a new ExecRunner with standard output rerouted to w.