spawn_srv

Function spawn_srv 

Source
pub async fn spawn_srv(
    launcher_exe_dir: &Path,
    paths: &DataPaths,
    srv_pipe_path: &str,
    job_handle: HANDLE,
) -> Result<(SrvSpawnResult, Child), SrvSpawnError>
Expand description

Spawn srv as a child of the launcher, assigned to launcher’s Job Object J0 so it dies cleanly with the launcher tree.

launcher_exe_dir is used to locate the srv binary alongside the launcher (or in runtime/ for portable). paths carries the data + config dirs and is propagated to srv via env vars. job_handle is the launcher’s Job Object so srv joins the same kill-on-job-close contract as the host. Returns once srv prints AGENTMUXSRV-ESTART (or the 30s timeout fires).

Caller keeps the returned Child alive — drop closes srv’s stdin and srv’s existing PPID death-watcher takes over (already part of agentmux-srv per SPEC_BACKEND_LIFECYCLE.md).