Basic support for opening a browser maybe

This commit is contained in:
John Doty 2022-12-17 09:03:35 -08:00
parent d6c9ae8d71
commit 1a5228c380
2 changed files with 19 additions and 6 deletions

View file

@ -10,13 +10,15 @@ use browse_unix::{browse_url_impl, handle_browser_open_impl};
#[inline]
pub async fn browse_url(url: &String) {
browse_url_impl(url).await
if let Err(e) = browse_url_impl(url).await {
eprintln!("{}", e);
std::process::exit(1);
}
}
#[cfg(not(target_family = "unix"))]
pub async fn browse_url_impl(url: &String) {
print!("Opening a browser is not supported on this platform\n");
std::process::exit(1);
pub async fn browse_url_impl(url: &String) -> Result<()> {
anyhow!("Opening a browser is not supported on this platform")
}
#[inline]