summaryrefslogtreecommitdiff
path: root/cli/src
diff options
context:
space:
mode:
authorTimme Bethe <58276357+tbethe@users.noreply.github.com>2023-04-11 14:06:38 +0200
committerGitHub <noreply@github.com>2023-04-11 14:06:38 +0200
commitef50f1b011af61d7f145fcbb25e90fb002d5f785 (patch)
treee44f55e30cd20f5ffa78649725a0aa311c789c1e /cli/src
parent6f625fc73cd17f1a1025e88022e67730fb11b5c4 (diff)
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.
Diffstat (limited to 'cli/src')
-rw-r--r--cli/src/main.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/cli/src/main.rs b/cli/src/main.rs
index 1190232d..0ae87db5 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(())