Std.Process
Low-level process control: exiting the VM and catching panics.
Types
SignalKind
type SignalKind =
| SigHup
| SigQuit
| SigAbrt
| SigAlrm
| SigTerm
| SigUsr1
| SigUsr2
| SigChld
| SigTstpOS signals that can be observed via the Signal effect.
Note: SIGINT (Ctrl-C) and SIGKILL are not in this list — SIGINT is claimed
by the BEAM break handler and SIGKILL is uncatchable at the OS level.
For graceful shutdown, send SIGTERM (e.g. kill -TERM <pid>).
Effects
Signal
effect Signal {
fun await_signal : (kind: SignalKind) -> Unit
}Signal effect: blocks the calling process until the given OS signal arrives.
Handlers
beam_signal
handler beam_signal for SignalNative handler for the Signal effect.
Functions
exit
fun exit : (code: Int) -> aImmediately terminates the VM with the given exit code. This is equivalent to erlang:halt/1.
shutdown
fun shutdown : (code: Int) -> aGracefully shuts down the VM with the given exit code. Flushes IO, runs shutdown procedures, then terminates. This is equivalent to init:stop/1.
catch_panic
fun catch_panic : (f: Unit -> a needs {..e}) -> Result a String needs {..e}Run a function and recover if it panics. Returns Ok(value) on success, Err(message) if the function panicked. Panics still crash the program by default — this is an opt-in recovery boundary.