diff --git a/src/rustup-utils/src/raw.rs b/src/rustup-utils/src/raw.rs index 00ed137f6b..fe228b0769 100644 --- a/src/rustup-utils/src/raw.rs +++ b/src/rustup-utils/src/raw.rs @@ -355,9 +355,15 @@ pub fn open_browser(path: &Path) -> io::Result { #[cfg(not(windows))] fn inner(path: &Path) -> io::Result { use std::process::Stdio; + use std::env; + + let env_browser = env::var_os("BROWSER").map(|b| env::split_paths(&b).collect::>()); + let env_commands = env_browser.as_ref() + .map(|cmds| cmds.iter().by_ref().filter_map(|b| b.to_str()).collect()) + .unwrap_or(vec![]); let commands = ["xdg-open", "open", "firefox", "chromium", "sensible-browser"]; - if let Some(cmd) = find_cmd(&commands) { + if let Some(cmd) = find_cmd(&env_commands).or(find_cmd(&commands)) { Command::new(cmd) .arg(path) .stdin(Stdio::null())