From aa3399d489f8d1bb269f8df4d2def19571f7560a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Fri, 11 Mar 2016 13:22:36 +0100 Subject: [PATCH] Add $BROWSER as possible client --- src/cargo/ops/cargo_doc.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/cargo/ops/cargo_doc.rs b/src/cargo/ops/cargo_doc.rs index ff4e1ec2694..9c6ca350b72 100644 --- a/src/cargo/ops/cargo_doc.rs +++ b/src/cargo/ops/cargo_doc.rs @@ -1,4 +1,5 @@ use std::collections::HashSet; +use std::env; use std::fs; use std::path::Path; use std::process::Command; @@ -62,6 +63,12 @@ pub fn doc(manifest_path: &Path, #[cfg(not(any(target_os = "windows", target_os = "macos")))] fn open_docs(path: &Path) { + // trying $BROWSER + match env::var("BROWSER").map(|name| Command::new(name).arg(path).status()) { + Ok(_) => return, + Err(_) => () + } + // trying xdg-open match Command::new("xdg-open").arg(path).status() { Ok(_) => return,