diff --git a/src/terminal/browser.rs b/src/terminal/browser.rs index a8ce5bbba..77b4a7ddb 100644 --- a/src/terminal/browser.rs +++ b/src/terminal/browser.rs @@ -1,16 +1,27 @@ -use std::process::Command; +use std::process::{Command, Stdio}; pub fn open_browser(url: &str) -> Result<(), failure::Error> { - let _output = if cfg!(target_os = "windows") { + if cfg!(target_os = "windows") { let url_escaped = url.replace("&", "^&"); let windows_cmd = format!("start {}", url_escaped); - Command::new("cmd").args(&["/C", &windows_cmd]).output()? + Command::new("cmd") + .args(&["/C", &windows_cmd]) + .stdout(Stdio::null()) + .spawn()?; } else if cfg!(target_os = "linux") { let linux_cmd = format!(r#"xdg-open "{}""#, url); - Command::new("sh").arg("-c").arg(&linux_cmd).output()? + Command::new("sh") + .arg("-c") + .arg(&linux_cmd) + .stdout(Stdio::null()) + .spawn()?; } else { let mac_cmd = format!(r#"open "{}""#, url); - Command::new("sh").arg("-c").arg(&mac_cmd).output()? + Command::new("sh") + .arg("-c") + .arg(&mac_cmd) + .stdout(Stdio::null()) + .spawn()?; }; Ok(())