MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / open_in_browser

Function open_in_browser

atomic-cli/src/commands/triage/mod.rs:229–251  ·  view source on GitHub ↗

Spawn the platform's default opener for a URL, detached.

(target: &str)

Source from the content-addressed store, hash-verified

227
228/// Spawn the platform's default opener for a URL, detached.
229fn 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)]

Callers 1

write_and_open_htmlFunction · 0.85

Calls 1

spawnMethod · 0.80

Tested by

no test coverage detected