Skip to content

Commit

Permalink
Add $BROWSER as possible client
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNeikos committed Mar 11, 2016
1 parent d6e148d commit aa3399d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/cargo/ops/cargo_doc.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::collections::HashSet;
use std::env;
use std::fs;
use std::path::Path;
use std::process::Command;
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit aa3399d

Please sign in to comment.