1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 05:12:40 +03:00

wezterm-mux-server: keep running after all panes are gone

This has been a commonly requested feature in the past week,
and it's a reasonable one.  The mux server inherited the
close-when-done behavior from when it used to be an alternate
front-end in the same executable as the gui, but it doesn't
need to be that way any more.

We also need to accomodate that case in the client: if the
newly attached domain doesn't result in any panes being imported,
we need to spawn a new command there in order to keep the client
alive.  The pre-existing check for whether the mux was empty had
false positives because the local mux may still reference the
pane from the connection UI, which would finish closing out shortly
after we had decided not to spawn anything, and then the client
would close.

refs: https://github.com/wez/wezterm/issues/631
refs: https://github.com/wez/wezterm/issues/507
This commit is contained in:
Wez Furlong 2021-04-03 15:00:08 -07:00
parent fe6a3a2cf0
commit 5cc29d1d8c
2 changed files with 6 additions and 6 deletions

View File

@ -256,7 +256,12 @@ async fn spawn_tab_in_default_domain_if_mux_is_empty(
let domain = mux.default_domain();
domain.attach().await?;
if !mux.is_empty() {
let have_panes_in_domain = mux
.iter_panes()
.iter()
.any(|p| p.domain_id() == domain.domain_id());
if have_panes_in_domain {
return Ok(());
}

View File

@ -183,11 +183,6 @@ fn run() -> anyhow::Result<()> {
loop {
executor.tick()?;
if Mux::get().unwrap().is_empty() && mux::activity::Activity::count() == 0 {
log::error!("No more tabs; all done!");
return Ok(());
}
}
}