Expand description
Daemon lifecycle: PID file, launch (Unix double-fork+exec), stop.
On Unix the launch sequence is: parse CLI, authenticate in the
foreground (so Steam Guard works), save the refresh token via the
existing save_token path, fork once to escape the controlling
terminal, setsid, fork again, then exec the same binary with a
--daemon-resume flag. The resumed child rebuilds a fresh tokio
runtime, re-authenticates using the saved token (fast, no prompts),
binds the socket, and enters the accept loop. The original parent
waits on a pipe for the resumed child to report its PID, prints the
info block, and exits 0.
Functions§
- detach_
and_ exec_ resume - Spawn the daemon child detached from this process and probe the socket until it binds.
- launch_
daemon_ authenticate - Phase 1 of
daemon start: preflight + foreground authentication. - load_
recent_ history - Load persisted recent-job history, if any, into the given state’s ring. Silent on failure – a missing or corrupt file just means we start with an empty history.
- log_
path - pid_
file_ path - read_
pid_ file - recent_
history_ path - Path to the JSON file where the daemon persists its
recentring on shutdown and reloads on startup. Co-located with the PID and log. - remove_
pid_ file - render_
daemon_ info - Render the
daemon infoblock to stdout. Does NOT contact the daemon. Useful for diagnosing a wedged daemon. - save_
recent_ history - Snapshot the recent ring to disk. Best-effort: any I/O failure is logged but does not block shutdown.
- serve_
resumed - The actual long-lived daemon process, post-exec. Builds a fresh tokio runtime above this; this just runs the accept loop.
- write_
pid_ file