Help us shape the future of Go! Take the 2026 Go Developer Survey

supervisor

package
v0.43.15 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package supervisor provides a lightweight process wrapper that runs a command in the foreground while accepting restart/stop signals over a Unix socket. The user sees all output in their terminal; external callers (agents, MCP) control the lifecycle via the socket.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PidPath added in v0.43.14

func PidPath(socketPath string) string

PidPath returns the supervisor PID file path corresponding to a socket path.

func Send

func Send(socketPath, command string) (string, error)

Send connects to a supervisor socket and sends a command. Returns the response string. Uses a 30-second deadline.

func SendWithTimeout

func SendWithTimeout(socketPath, command string, timeout time.Duration) (string, error)

SendWithTimeout is like Send but with a caller-specified deadline. Used by --await which may need to wait longer than the default 30s.

func SocketPath

func SocketPath(worktreePath string) string

SocketPath returns a short, deterministic socket path under /tmp to avoid the ~104 byte macOS limit on Unix socket paths. The hash ensures uniqueness per worktree without depending on path length.

Types

type Supervisor

type Supervisor struct {
	Command    string
	Dir        string
	SocketPath string
	Port       int
	Env        map[string]string // extra env vars injected into the child process
	Log        func(format string, args ...any)
	// ConnWriteDeadline caps how long handleConn waits to write a response.
	// Defaults to 15s. Override in tests to avoid slow-test hangs.
	ConnWriteDeadline time.Duration
	// contains filtered or unexported fields
}

func New

func New(command, dir, socketPath string) *Supervisor

func (*Supervisor) Run

func (s *Supervisor) Run() error

Jump to

Keyboard shortcuts

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