Skip to main content

control_dir

Function control_dir 

Source
pub fn control_dir(config_home: &Path) -> Option<PathBuf>
Expand description

Where ControlMaster sockets go (macOS and Linux; Windows’ OpenSSH has no connection sharing): a private, owner-only directory, since anyone who can open a socket there can use the connection. None (no sharing; ssh still connects) if it can’t be made so, or a socket in it would be too long.

Not under config_home: a channel’s config dir is deep (/Users/<name>/.agentmux/channels/stable/config), and a Unix socket path has to fit in sun_path, 104 bytes on macOS and 108 on Linux. Under it, ssh failed with “too long for Unix domain socket” right after logging in, on every macOS install. So: the launcher’s short runtime dir ($XDG_RUNTIME_DIR/agentmux, else /tmp/agentmux-<uid>, as launcher::ipc::ipc_socket_dir_path) and one ssh-<hash> per channel.