Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Cmd ¶
type Opt ¶
type Opt struct {
// contains filtered or unexported fields
}
func (*Opt) Supervise ¶
Example ¶
package main
import (
"context"
"errors"
"fmt"
"os"
"time"
"codeberg.org/msantos/supervises/pkg/supervises"
)
func main() {
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
defer cancel()
s := supervises.New(ctx)
cmds, err := s.Cmd("@echo test123; exec sleep 10", "cat")
if err != nil {
fmt.Fprintln(os.Stderr, err)
return
}
err = s.Supervise(cmds...)
var ee *supervises.ExitError
if !errors.As(err, &ee) {
fmt.Fprintln(os.Stderr, err.Error())
return
}
}
Output: test123
type Option ¶
type Option func(*Opt)
func WithCancelFunc ¶
WithCancelFunc sets the function to reap cancelled subprocesses.
func WithCancelSignal ¶
WithCancelSignal sets the signal sent to subprocesses on exit.
func WithNotifySignals ¶
WithNotifySignals sets trapped signals by the supervisor.
Click to show internal directories.
Click to hide internal directories.