mirror of
https://github.com/typst/typst
synced 2025-05-14 17:15:28 +08:00
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.
This commit is contained in:
parent
6f625fc73c
commit
ef50f1b011
@ -348,13 +348,9 @@ fn print_diagnostics(
|
|||||||
/// - The given viewer provided by `open` if it is `Some`.
|
/// - The given viewer provided by `open` if it is `Some`.
|
||||||
fn open_file(open: Option<&str>, path: &Path) -> StrResult<()> {
|
fn open_file(open: Option<&str>, path: &Path) -> StrResult<()> {
|
||||||
if let Some(app) = open {
|
if let Some(app) = open {
|
||||||
open::with(path, app).map_err(|err| {
|
open::with_in_background(path, app);
|
||||||
format!("failed to open `{}` with `{}`, reason: {}", path.display(), app, err)
|
|
||||||
})?;
|
|
||||||
} else {
|
} else {
|
||||||
open::that(path).map_err(|err| {
|
open::that_in_background(path);
|
||||||
format!("failed to open `{}`, reason: {}", path.display(), err)
|
|
||||||
})?;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user