bind_first_pipe_instance

Function bind_first_pipe_instance 

Source
pub fn bind_first_pipe_instance(pipe_name: &str) -> Result<NamedPipeServer>
Expand description

Bind the first named-pipe instance synchronously.

Phase B.6: the bind is the single-instance signal. Splitting it out of run_ipc_server lets the caller (main.rs) detect a collision BEFORE spawning srv/host and surface a user-visible error (“AgentMux is already running”). ServerOptions::create requires a Tokio runtime context for IOCP registration, so this must be called from inside #[tokio::main] (or any task on the runtime) — not from a plain sync entrypoint.

On Windows, a second launcher hitting the same pipe gets ERROR_ACCESS_DENIED (raw OS error 5); other errors mean the pipe namespace itself is misconfigured.