Spawn the daemon process in the background.
(ws_url: &str)
| 43 | |
| 44 | /// Spawn the daemon process in the background. |
| 45 | pub fn spawn_daemon(ws_url: &str) -> Result<()> { |
| 46 | let exe = std::env::current_exe()?; |
| 47 | let mut cmd = std::process::Command::new(&exe); |
| 48 | cmd.args(["__daemon__", ws_url]) |
| 49 | .stdin(std::process::Stdio::null()) |
| 50 | .stdout(std::process::Stdio::null()) |
| 51 | .stderr(std::process::Stdio::null()); |
| 52 | |
| 53 | #[cfg(windows)] |
| 54 | cmd.creation_flags(0x08000000); // CREATE_NO_WINDOW |
| 55 | |
| 56 | cmd.spawn()?; |
| 57 | Ok(()) |
| 58 | } |
| 59 | |
| 60 | /// Wait for the daemon socket to become available, with exponential backoff. |
| 61 | pub async fn wait_for_daemon() -> Result<()> { |