(explicit: Option<&str>)
| 1203 | } |
| 1204 | |
| 1205 | fn command_service_url(explicit: Option<&str>) -> anyhow::Result<String> { |
| 1206 | if let Some(url) = explicit |
| 1207 | .map(ToOwned::to_owned) |
| 1208 | .or_else(|| env::var("SIMDECK_SERVER_URL").ok()) |
| 1209 | .filter(|value| !value.trim().is_empty()) |
| 1210 | { |
| 1211 | return Ok(url); |
| 1212 | } |
| 1213 | if let Some(result) = service::active()? { |
| 1214 | return Ok(http_url_for_host("127.0.0.1", result.port)); |
| 1215 | } |
| 1216 | if let Some(metadata) = read_service_metadata().ok().flatten() { |
| 1217 | if service_is_healthy(&metadata) { |
| 1218 | return Ok(metadata.http_url); |
| 1219 | } |
| 1220 | } |
| 1221 | Ok(ensure_singleton_service(ServiceLaunchOptions::default())?.http_url) |
| 1222 | } |
| 1223 | |
| 1224 | fn command_service_url_for_udid( |
| 1225 | udid: &str, |
no test coverage detected