Skip to main content

Module spawn

Module spawn 

Source
Expand description

Daemon auto-spawn.

vs and the daemon are the same binary. When the CLI runs and the daemon socket is missing, spawn_daemon re-execs vs serve detached from the current process. The CLI then waits for the socket to appear (with a timeout). Failure to spawn or connect within the budget yields a local error (the user sees ! DAEMON_START_FAILED-equivalent stderr).

Functions§

daemon_binary
Path to the vs binary that should run the daemon. Resolution order:
spawn_daemon
Spawn vs serve detached. Inherits no stdio so the CLI process is not kept alive by the daemon’s pipes.
wait_for_socket
Wait until a daemon is reachable at socket, polling at ~50ms. On Unix this checks for the AF_UNIX socket file; on Windows it connect-probes the named pipe (pipes don’t appear on the filesystem). Returns Ok(()) on success, error on timeout.