From fb1a659c4c080864faae0ee830de2ad7ff3518c0 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Mon, 27 Jun 2022 16:47:00 -0700 Subject: [PATCH] fix `wezterm connect sshdomain` when password auth is needed We need the mux window builder to notify in order for the ConnectionUI to show up, but we wouldn't trigger the notify (which happens on drop) until we'd awaited the connection ui completing password auth. Force it to drop earlier to unblock. refs: https://github.com/wez/wezterm/issues/2194 --- docs/changelog.md | 1 + wezterm-gui/src/main.rs | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index c04e92464..9d8c747e3 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -14,6 +14,7 @@ As features stabilize some brief notes about them will accumulate here. #### Fixed * [ActivateKeyTable](config/lua/keyassignment/ActivateKeyTable.md)'s `replace_current` field was not actually optional. Made it optional. [#2179](https://github.com/wez/wezterm/issues/2179) * `winget` causes toast notification spam [#2185](https://github.com/wez/wezterm/issues/2185) +* `wezterm connect sshdomain` could hang on startup if password authentication was required [#2194](https://github.com/wez/wezterm/issues/2194) ### 20220624-141144-bd1b7c5d diff --git a/wezterm-gui/src/main.rs b/wezterm-gui/src/main.rs index 30d3179ee..62035fe87 100644 --- a/wezterm-gui/src/main.rs +++ b/wezterm-gui/src/main.rs @@ -295,9 +295,14 @@ async fn spawn_tab_in_default_domain_if_mux_is_empty( } } - let window_id = mux.new_empty_window(None); + let window_id = { + // Force the builder to notify the frontend early, + // so that the attach await below doesn't block it + let builder = mux.new_empty_window(None); + *builder + }; - domain.attach(Some(*window_id)).await?; + domain.attach(Some(window_id)).await?; let have_panes_in_domain = mux .iter_panes() @@ -322,7 +327,7 @@ async fn spawn_tab_in_default_domain_if_mux_is_empty( let dpi = config.dpi.unwrap_or_else(|| ::window::default_dpi()) as u32; let _tab = domain - .spawn(config.initial_size(dpi), cmd, None, *window_id) + .spawn(config.initial_size(dpi), cmd, None, window_id) .await?; Ok(()) }