supervisor

package
v1.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KillProcessGroup added in v1.4.0

func KillProcessGroup(cmd *exec.Cmd)

func ShellCommand added in v1.4.0

func ShellCommand(cmdStr string) *exec.Cmd

Types

type LogEntry

type LogEntry struct {
	Time   time.Time `json:"time"`
	Line   string    `json:"line"`
	Source string    `json:"source"`
}

LogEntry holds a single log line, its source, and when it was written. Source is "stdout", "stderr", or "invincible".

type ProcessStatus

type ProcessStatus struct {
	Name      string
	State     string
	PID       int
	Cmd       string
	Cwd       string
	Port      int
	PortEnv   string
	Env       map[string]string
	DependsOn []string
	Restarts  int
	StartedAt time.Time
	Watching  bool
}

type State

type State int
const (
	StateStopped State = iota
	StateStarting
	StateProbing
	StateRunning
	StateCrashed
	StateBuilding
)

func (State) String

func (s State) String() string

type Supervisor

type Supervisor struct {
	// contains filtered or unexported fields
}

func New

func New(cfgs []config.ProcessConfig) *Supervisor

func (*Supervisor) Build added in v1.4.0

func (s *Supervisor) Build(name, buildCmd, cwd string, ctx context.Context) error

Build runs a build command for the named process. The process must be running. Log output is written to the process's invincible log stream. If ctx is cancelled, the build command is killed and the state reverts.

func (*Supervisor) Log added in v1.4.0

func (s *Supervisor) Log(name, message string)

Log writes a message to a process's invincible log stream.

func (*Supervisor) Logs

func (s *Supervisor) Logs(name string, n int) []LogEntry

func (*Supervisor) Restart

func (s *Supervisor) Restart(name string) error

func (*Supervisor) RestartAll

func (s *Supervisor) RestartAll()

RestartAll restarts every process in dependency order. Each level starts after the previous level has reached running.

func (*Supervisor) Start

func (s *Supervisor) Start(name string) error

func (*Supervisor) StartAll

func (s *Supervisor) StartAll()

func (*Supervisor) Status

func (s *Supervisor) Status() []ProcessStatus

func (*Supervisor) Stop

func (s *Supervisor) Stop(name string) error

func (*Supervisor) StopAll

func (s *Supervisor) StopAll()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL