From ffac28745b56b9bc3a89fb7f6e1a7621f1878c84 Mon Sep 17 00:00:00 2001 From: David Knaack Date: Fri, 30 Oct 2020 18:36:12 +0100 Subject: [PATCH] fix(bug-report): verify exit code of open, always print url (#1839) * fix(bug-report): verify exit code of browser open * always print url to open ticket --- src/bug_report.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/bug_report.rs b/src/bug_report.rs index a2d757c0..3e357538 100644 --- a/src/bug_report.rs +++ b/src/bug_report.rs @@ -19,16 +19,19 @@ pub fn create() { }; let link = make_github_issue_link(crate_version!(), environment); + let short_link = shorten_link(&link); - if open::that(&link).is_ok() { - print!("Take a look at your browser. A GitHub issue has been populated with your configuration") + if open::that(&link) + .map(|status| status.success()) + .unwrap_or(false) + { + println!("Take a look at your browser. A GitHub issue has been populated with your configuration."); + println!("If your browser has failed to open, please click this link:\n"); } else { - let link = shorten_link(&link).unwrap_or(link); - println!( - "Click this link to create a GitHub issue populated with your configuration:\n\n {}", - link - ); + println!("Click this link to create a GitHub issue populated with your configuration:\n"); } + + println!(" {}", short_link.unwrap_or(link)); } #[cfg(feature = "http")]