pub(crate) fn bind_socket_with_recovery(
socket_path: &str,
data_dir: &Path,
dir_hash: &str,
channel: &str,
) -> UnixListenerExpand description
Bind the launcher’s IPC socket with single-instance enforcement +
crash-safe stale-socket recovery, serialized across concurrent
launchers via flock(2).
Returns a bound UnixListener on success. Calls std::process::exit
on:
- second-instance detection (exit code 0)
- a hard bind failure that isn’t
EADDRINUSE(exit code 2) - unable to acquire the recovery lock (exit code 2)
Why the lockfile (codex P1 + reagent P1 on PR #1288): see the call- site comment. Two-launcher concurrent stale-cleanup would otherwise produce two live launchers for one data dir.