Skip to main content

Module launchd

Module launchd 

Source
Expand description

Boot persistence on macOS (ARCHITECTURE.md §3): register the daemon as a launchd user agent so the lease is a system guarantee across reboots and crashes. If registration is refused, stackless degrades loudly — status/list read the reason from daemon.persistence and warn that leases hold only while the daemon happens to run.

KeepAlive is { SuccessfulExit = false }: launchd restarts a crash but honors a clean drain, so daemon stop and the upgrade handshake (§3) still take the daemon down for good.

Constants§

LABEL

Functions§

degradation_warning
The degradation warning for status/listNone when persistence is registered (the steady state), Some(line) when it is degraded.
ensure_registered
Ensure the LaunchAgent exists and is bootstrapped. Records the outcome to daemon.persistence and never fails the daemon: a refused registration degrades loudly rather than aborting (§3).
kickstart_if_supervised
Start the daemon under launchd supervision, returning true only when it actually ran the service via launchctl kickstart.
persistence_status_path
The one-line file status/list read: “registered” on success, the failure reason otherwise.
service_registered
Whether launchd currently knows our service in the caller’s gui domain — the live fact, unlike the daemon.persistence file, which only records the outcome of the last daemon startup.