Skip to content

Commit ef50f1b

Browse files
authored
Fixes CLI blocking upon opening pdf viewer (typst#706)
Fixes issue 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.
1 parent 6f625fc commit ef50f1b

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

cli/src/main.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -348,13 +348,9 @@ fn print_diagnostics(
348348
/// - The given viewer provided by `open` if it is `Some`.
349349
fn open_file(open: Option<&str>, path: &Path) -> StrResult<()> {
350350
if let Some(app) = open {
351-
open::with(path, app).map_err(|err| {
352-
format!("failed to open `{}` with `{}`, reason: {}", path.display(), app, err)
353-
})?;
351+
open::with_in_background(path, app);
354352
} else {
355-
open::that(path).map_err(|err| {
356-
format!("failed to open `{}`, reason: {}", path.display(), err)
357-
})?;
353+
open::that_in_background(path);
358354
}
359355

360356
Ok(())

0 commit comments

Comments
 (0)