processes
Programs declared with session_process: running state, start time and last exit.
Declare programs with session_process: it sends these
actions and exposes each field as a signal. Read mantle.processes directly to see every declared
program in one table.
text {
content = mantle.processes:map(function(processes)
local recorder = processes and processes.sessions.recorder
return (recorder and recorder.running) and "● REC" or ""
end),
}
State
mantle.processes:get() returns ProcessesState, nil before the first push. A field marked ? may be absent.
mantle.processes payload.
| Field | Type | Description |
|---|---|---|
sessions | table<string, SessionProcess> | One entry per session_process name; an undeclared name is nil. |
SessionProcess
One declared program: its current run, or what is left of its last one.
| Field | Type | Description |
|---|---|---|
exit_code? | integer | Exit status of the last run; nil while running, before any run, or when a signal killed it. |
pid? | integer | Process id, also its process group id; kept after exit, nil before a spawn or after a failed start. |
running | boolean | Whether it is up now. Otherwise the fields below describe the last run. |
start_error | string | Why the last start failed to spawn, e.g. a cmd not on PATH; empty when it spawned. |
started_at? | integer | Unix seconds when the run began; nil before a spawn or after a failed start. |
Actions
Call each as mantle.processes:<action>(arguments...); ? marks an argument you may omit.
| Action | Arguments | Description |
|---|---|---|
declare | name: string, stop_signal?: SignalName | Registers name (required before start) and sets its stop signal, default TERM. Redeclaring updates the signal without touching a running program. |
start | name: string, cmd: string, args?: string[] | Runs cmd with args (no shell) as its own process group. No-op while running or when name is undeclared. |
signal | name: string, signal: SignalName | Sends signal to the program’s process (not its group); no-op when not running. |
stop | name: string | Sends the declared stop signal to the process group, then KILL if it is still up 5 s later; no-op when not running. |
SignalName
A signal name without the SIG prefix.
One of "TERM", "INT", "HUP", "QUIT", "USR1", "USR2", "KILL", "STOP", "CONT".
Backend
The Supervisor spawns and owns each program, so it outlives reloads and Renderer replacement. One
task per program holds its child and sends every signal, so a signal never reaches a recycled pid.
When to use process.run or process.detach instead:
processes.