Skip to main content

stop

Function stop 

Source
pub fn stop(
    home: &Path,
    patience: Result<Duration, String>,
) -> Result<StopVerdict, ServerError>
Expand description

Stop the server recorded under home, waiting up to patience for it to exit. patience is operator-ruled at invocation — the CLI passes the --patience flag, the verified-running record’s drain window, or the config’s own drain_timeout; this function never invents a value.

patience arrives as a Result because its resolution can fail (a config that cannot load) and that failure must be carried to the point of need rather than destroy the verb’s answer: only a VERIFIED-RUNNING server needs a wait window, so only the Verified arm consults the Err — and refuses, naming the running pid and the remedy. Every other face (no pid file, already gone, stale incarnation) decides without a window, exactly as it would with one.

§Errors

Returns ServerError only for an I/O failure reading the pid file — before any action is decided. Every decision the verb itself makes is a typed StopVerdict, and once the server is proven exited, bookkeeping failures (death note, pid-file reconciliation) ride INSIDE the outcome rather than erroring out of it (see [exit_bookkeeping]).