| 173 | } |
| 174 | |
| 175 | fn wait_for_daemon(socket: &Path, child: &mut Child) { |
| 176 | let deadline = Instant::now() + Duration::from_secs(30); |
| 177 | loop { |
| 178 | if let Some(status) = child.try_wait().expect("inspect daemon") { |
| 179 | panic!("atomicd exited with {status} during bootstrap"); |
| 180 | } |
| 181 | if socket.exists() { |
| 182 | return; |
| 183 | } |
| 184 | assert!( |
| 185 | Instant::now() < deadline, |
| 186 | "atomicd never bound {}", |
| 187 | socket.display() |
| 188 | ); |
| 189 | std::thread::sleep(Duration::from_millis(25)); |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | fn spawn_daemon(socket: &Path, extra_envs: &[(&str, &str)]) -> Child { |
| 194 | let _ = std::fs::remove_file(socket); |