1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-22 21:01:36 +03:00

ensure that we spawn open calls on a background thread

Otherwise we can block the gui waiting for eg: a freshly opened firefox to
terminate.

See also comment worrying about this in
75066cb522.
That fear was realized but now resolved!

refs: https://github.com/wez/wezterm/issues/2245
This commit is contained in:
Wez Furlong 2022-07-11 08:03:37 -07:00
parent cfd9c0b364
commit 870ffdf59a
4 changed files with 16 additions and 8 deletions

View File

@ -43,6 +43,7 @@ As features stabilize some brief notes about them will accumulate here.
* Tab bar could show a gap to the right when resizing
* Padding could show window background rather than pane background around split panes at certain window sizes [#2210](https://github.com/wez/wezterm/issues/2210)
* Loading dynamic escape sequence scripts from the [iTerm2-Color-Scheme dynamic-colors directory](https://github.com/mbadolato/iTerm2-Color-Schemes/tree/master/dynamic-colors) would only apply the first 7 colors
* Unix: Clicking a URL when no browser is open could cause wezterm to hang until the newly opened browser is closed. [#2245](https://github.com/wez/wezterm/issues/2245)
#### Updated
* Bundled harfbuzz to 4.4.1

View File

@ -20,9 +20,11 @@ fn open_with<'lua>(_: &'lua Lua, (url, app): (String, Option<String>)) -> mlua::
if let Some(app) = app {
open::with_in_background(url, app);
} else {
if let Err(err) = open::that(&url) {
log::error!("Error opening {}: {:#}", url, err);
}
std::thread::spawn(move || {
if let Err(err) = open::that(&url) {
log::error!("Error opening {}: {:#}", url, err);
}
});
}
Ok(())
}

View File

@ -2519,10 +2519,12 @@ impl TermWindow {
None => true,
};
if default_click {
log::info!("clicking {}", link);
if let Err(err) = open::that(&link) {
log::error!("Error opening {}: {:#}", link, err);
}
std::thread::spawn(move || {
log::info!("clicking {}", link);
if let Err(err) = open::that(&link) {
log::error!("Error opening {}: {:#}", link, err);
}
});
}
Ok(())
}

View File

@ -126,7 +126,10 @@ async fn show_notif_impl(notif: ToastNotification) -> Result<(), Box<dyn std::er
let args = signal.args()?;
if args.nid == notification {
if let Some(url) = notif.url.as_ref() {
let _ = open::that(url);
let url = url.clone();
std::thread::spawn(move || {
let _ = open::that(url);
});
abort_closed.abort();
break;
}