Spawn the platform's default opener for a URL, detached.
(target: &str)
| 227 | |
| 228 | /// Spawn the platform's default opener for a URL, detached. |
| 229 | fn open_in_browser(target: &str) -> std::io::Result<()> { |
| 230 | #[cfg(target_os = "macos")] |
| 231 | let mut cmd = { |
| 232 | let mut c = ProcessCommand::new("open"); |
| 233 | c.arg(target); |
| 234 | c |
| 235 | }; |
| 236 | #[cfg(target_os = "windows")] |
| 237 | let mut cmd = { |
| 238 | let mut c = ProcessCommand::new("cmd"); |
| 239 | c.args(["/C", "start", "", target]); |
| 240 | c |
| 241 | }; |
| 242 | #[cfg(all(unix, not(target_os = "macos")))] |
| 243 | let mut cmd = { |
| 244 | let mut c = ProcessCommand::new("xdg-open"); |
| 245 | c.arg(target); |
| 246 | c |
| 247 | }; |
| 248 | |
| 249 | cmd.stdout(Stdio::null()).stderr(Stdio::null()).spawn()?; |
| 250 | Ok(()) |
| 251 | } |
| 252 | |
| 253 | /// Build the canonical triage report for a view relative to a target. |
| 254 | #[derive(Debug, Parser)] |
no test coverage detected