From ef50f1b011af61d7f145fcbb25e90fb002d5f785 Mon Sep 17 00:00:00 2001 From: Timme Bethe <58276357+tbethe@users.noreply.github.com> Date: Tue, 11 Apr 2023 14:06:38 +0200 Subject: [PATCH] Fixes CLI blocking upon opening pdf viewer (#706) Fixes issue typst/typst#704 by making opening a pdf viewer non-blocking. This does remove error reporting when the pdf viewer fails to be opened. This error reporting is difficult to regain since the error happens on a different thread. --- cli/src/main.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/cli/src/main.rs b/cli/src/main.rs index 1190232d2..0ae87db5b 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -348,13 +348,9 @@ fn print_diagnostics( /// - The given viewer provided by `open` if it is `Some`. fn open_file(open: Option<&str>, path: &Path) -> StrResult<()> { if let Some(app) = open { - open::with(path, app).map_err(|err| { - format!("failed to open `{}` with `{}`, reason: {}", path.display(), app, err) - })?; + open::with_in_background(path, app); } else { - open::that(path).map_err(|err| { - format!("failed to open `{}`, reason: {}", path.display(), err) - })?; + open::that_in_background(path); } Ok(())