aboutsummaryrefslogtreecommitdiff
path: root/src/app/worktrees.rs
diff options
context:
space:
mode:
authorJJ Liebig <jonathan.liebig@gmail.com>2026-09-02 18:08:10 +0200
committerGitHub <noreply@github.com>2026-09-02 18:08:10 +0200
commit5a2dee700eeeea68267a4d16777307632f77172f (patch)
tree3a7b2b0ead7af9cb1bfc069e5f61ce56a5f4909f /src/app/worktrees.rs
parent987b070fbfa187e85009b45cd7e208fc6175ff6a (diff)
fix(windows): remove worktrees with active agent panes (#3532)
* fix(windows): remove worktrees with active agent panes * fix(windows): defer pane restore until shutdown exits
Diffstat (limited to 'src/app/worktrees.rs')
-rw-r--r--src/app/worktrees.rs17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/app/worktrees.rs b/src/app/worktrees.rs
index b4ac1482..c26d5dea 100644
--- a/src/app/worktrees.rs
+++ b/src/app/worktrees.rs
@@ -39,15 +39,28 @@ impl App {
pub(crate) fn shutdown_workspace_terminal_runtimes_for_worktree_remove(
&mut self,
ws_idx: usize,
- ) {
- for terminal_id in self.state.terminal_ids_for_workspace(ws_idx) {
+ ) -> Vec<crate::layout::PaneId> {
+ let mut shutdown_panes = Vec::new();
+ for pane_id in self.state.pane_ids_for_workspace(ws_idx) {
+ let Some(terminal_id) = self.state.terminal_id_for_pane(ws_idx, pane_id) else {
+ continue;
+ };
+ if self.terminal_runtimes.get(&terminal_id).is_none() {
+ continue;
+ }
tracing::debug!(
workspace_index = ws_idx,
terminal_id = %terminal_id,
"shutting down terminal runtime before worktree removal"
);
+ *self
+ .pending_worktree_remove_runtime_exits
+ .entry(pane_id)
+ .or_default() += 1;
+ shutdown_panes.push(pane_id);
self.shutdown_terminal_runtime(terminal_id);
}
+ shutdown_panes
}
}