Skip to content

supervisor

Functions


firma_run::supervisor::wait_with_signal_forwarding

Section titled “firma_run::supervisor::wait_with_signal_forwarding”

Function

Wait for the child while forwarding terminal signals to the sandbox.

The child is reaped with a plain blocking Child::wait on this thread — no SIGCHLD handling — so reaping is correct regardless of how many threads the caller runs (a sigwait/SIGCHLD scheme only works when the signal is blocked process-wide, which does not hold under the multi-threaded test harness and hangs on some platforms).

A background thread receives SIGINT, SIGTERM, and SIGWINCH via signal_hook’s self-pipe and forwards each into the sandbox. SIGWINCH (TUI resize) is relayed as-is; the first SIGINT/SIGTERM is forwarded so an interactive TUI can shut down cleanly, and a second termination signal escalates to SIGKILL. Once the child is reaped the signal source is closed, ending the forwarder thread.

Returns an error when the signal handlers cannot be installed or the child wait operation fails.

fn wait_with_signal_forwarding(child: std::process::Child, backend: crate::backend::BackendKind) -> Result<i32, crate::error::RunError>