pub struct Bridge { /* private fields */ }Expand description
A listening socket for the length of one run, removed when it goes out of scope.
Implementations§
Source§impl Bridge
impl Bridge
Sourcepub fn bind() -> Result<Self, ToolError>
pub fn bind() -> Result<Self, ToolError>
Bind a socket in a fresh 0700 directory under the system temporary directory.
The directory is per-run and mode 0700: the socket is only as private as the directory
that holds it, and a predictable path in a shared /tmp would let another user connect
and call tools as the agent.
The path is short on purpose — a Unix socket path is capped at SUN_LEN, and a scripts
directory under a deep config path can easily be half of that budget already.
A caller that runs the child under shell_isolate = "fs" binds Self::dir into the
namespace, because the child gets a fresh /tmp and would otherwise be told about a path
that does not exist where it runs (#550).
Must be called inside a Tokio runtime: the listener is handed to the reactor here, so that
accept in Self::wait_serving can be one arm of a select!.