From d2faa96271d336aad812cb17919e3228f94cfd33 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Wed, 8 Jun 2022 07:56:00 -0700 Subject: [PATCH] mux: restore same-domain check for cwd when spawning tabs I think this got lost when this mux function was refactored into this location from elsewhere. refs: #2092 --- mux/src/lib.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/mux/src/lib.rs b/mux/src/lib.rs index 1f46374e5..fcade7ff8 100644 --- a/mux/src/lib.rs +++ b/mux/src/lib.rs @@ -1084,7 +1084,18 @@ impl Mux { let cwd = self.resolve_cwd( command_dir, match current_pane_id { - Some(id) => self.get_pane(id), + Some(id) => { + // Only use the cwd from the current pane if the domain + // is the same as the one we are spawning into + let (current_domain_id, _, _) = self + .resolve_pane_id(id) + .ok_or_else(|| anyhow!("pane_id {} invalid", id))?; + if current_domain_id == domain.domain_id() { + self.get_pane(id) + } else { + None + } + } None => None, }, );