pub async fn run_if_socket_activated() -> Result<bool>Expand description
If the process was started bare via systemd socket activation, serve the
varlink API on the activated socket and return Ok(true). Otherwise return
Ok(false) so the caller falls through to normal CLI parsing.
This runs before clap to support a truly argument-less invocation —
notably varlinkctl exec:cfsctl, which hands us the connected socket on fd
3 but passes no subcommand for clap to parse. A client selects a repository
at runtime via the OpenRepository method.
The shortcut is taken only when there are no command-line arguments
(argv is just the program name). When any argument is present — e.g. a
systemd unit running cfsctl varlink — we fall through to clap; the
varlink/oci varlink subcommand’s serve
detects and serves on the activation fd itself. We must NOT call
try_activated_listener on that
path: it consumes LISTEN_FDS/LISTEN_PID (via receive_descriptors),
which would prevent serve from finding the fd later.