Documentation
¶
Overview ¶
Package procsup runs long-lived local helper processes (voice and language servers), one per key, and stops them with the daemon.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Process ¶
type Process struct {
// contains filtered or unexported fields
}
Process is a supervised child process.
type Spec ¶
type Spec struct {
Key string
Path string
Args []string
Env []string // nil inherits the daemon's environment
Stdin bool // keep a stdin pipe
Stdout bool // keep a stdout pipe
Log string // stderr log file name in the supervisor's log dir; "" discards
// Ready is one readiness probe; the supervisor repeats it until it passes,
// the process exits or ReadyTimeout ends. Nil means started is ready.
Ready func(ctx context.Context) error
ReadyTimeout time.Duration
}
Spec describes a process; two specs with the same command, environment and stdin mode run the same process.
type Supervisor ¶
type Supervisor struct {
// contains filtered or unexported fields
}
func New ¶
func New(logDir string) *Supervisor
func (*Supervisor) Running ¶
func (s *Supervisor) Running(key string) (*Process, bool)
Running is the live process of key.
func (*Supervisor) Start ¶
Start returns the running process of spec.Key when it was started from the same command, else replaces it, and waits until it is ready. The probe runs outside the supervisor lock; concurrent Starts of one key share it.
func (*Supervisor) Stop ¶
func (s *Supervisor) Stop(key string)
func (*Supervisor) StopAll ¶
func (s *Supervisor) StopAll()
StopAll stops every process; the daemon calls it on shutdown.