Documentation
¶
Overview ¶
Package process manages background processes started by run_command with background=true.
Index ¶
- type CommandStarted
- type ExitEvent
- type ExitReason
- type Manager
- func (m *Manager) Kill(id string) error
- func (m *Manager) KillAll()
- func (m *Manager) List() string
- func (m *Manager) Read(id string) (string, error)
- func (m *Manager) Remove(id string)
- func (m *Manager) SetExitHandler(handler func(ExitEvent))
- func (m *Manager) SetLimits(maxProcs int, outputOptions cmdoutput.Options)
- func (m *Manager) SetSessionProvider(provider func() string)
- func (m *Manager) Start(command string, timeoutSec int) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandStarted ¶
type CommandStarted struct {
ID string
Command string
SessionID string
StartedAt time.Time
// contains filtered or unexported fields
}
CommandStarted represents a running background process.
type ExitReason ¶
type ExitReason string
const ( ExitReasonCompleted ExitReason = "completed" ExitReasonError ExitReason = "error" ExitReasonTimeout ExitReason = "timeout" ExitReasonKilled ExitReason = "killed" )
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager tracks background processes.
func NewManager ¶
NewManager creates a new process Manager. maxProcs limits concurrent background processes (0 = unlimited).
func NewManagerAtRoot ¶
func (*Manager) Kill ¶
Kill terminates a background process. Sends SIGTERM, waits 500ms, then SIGKILL.
func (*Manager) KillAll ¶
func (m *Manager) KillAll()
KillAll terminates all running background processes.
func (*Manager) List ¶
List returns a formatted list of background processes for the current session.
func (*Manager) SetExitHandler ¶
SetExitHandler sets a callback invoked when a background process exits. The callback should append a system signal to the loop.
func (*Manager) SetSessionProvider ¶
SetSessionProvider sets a callback used to tag newly started background processes with the session that launched them.