Represents a child process whose state we want to control (start, stop, keep alive after crashes),



This section is empty.


This section is empty.


This section is empty.


type Controller

type Controller struct {
	// contains filtered or unexported fields

func New

func New(
	cmd []string,
	description string,
	controlLogger *log.Logger,
	logger *log.Logger,
	starter func(func(context.Context) error),
) *Controller

func (*Controller) Start

func (s *Controller) Start()

means not necessarily starting a single process, but instead that we'll want to keep this subprocess alive. if it dies, it might get restarted automatically, in which case it gets a new pid, new start time etc.

func (*Controller) Status

func (s *Controller) Status() Status

func (*Controller) Stop

func (s *Controller) Stop()

same goes as for start. stop means that we'll want the subprocess to stop (or "pause"). do not call this when you want to gracefully shut down your app, but instead use the stopper mechanism which will automatically tear things down gracefully

type Status

type Status struct {
	Description string
	Pid         string
	Alive       bool
	Started     time.Time

Source Files