mirror of
https://github.com/bendtherules/opencode-multi-model.git
synced 2026-08-18 13:42:21 +00:00
fix: streamline tmux session termination and cleanup logic
This commit is contained in:
+8
-8
@@ -53,6 +53,11 @@ export async function closeMultiModel(options: CloseSessionOptions): Promise<Clo
|
||||
// Check if session exists
|
||||
const { ok: sessionExists } = await runCommand(["tmux", "has-session", "-t", options.sessionName]);
|
||||
|
||||
// Kill tmux session if it exists
|
||||
if (sessionExists) {
|
||||
await runCommand(["tmux", "kill-session", "-t", options.sessionName]);
|
||||
}
|
||||
|
||||
// Get list of worktrees for this session before killing tmux
|
||||
const worktrees = await getWorktreesForSession(options.sessionName);
|
||||
|
||||
@@ -71,11 +76,6 @@ export async function closeMultiModel(options: CloseSessionOptions): Promise<Clo
|
||||
}
|
||||
}
|
||||
|
||||
// Kill tmux session if it exists
|
||||
if (sessionExists) {
|
||||
await runCommand(["tmux", "kill-session", "-t", options.sessionName]);
|
||||
}
|
||||
|
||||
let cleanupPerformed = false;
|
||||
|
||||
// Cleanup worktrees and optionally branches
|
||||
@@ -106,12 +106,12 @@ export async function closeMultiModel(options: CloseSessionOptions): Promise<Clo
|
||||
}
|
||||
}
|
||||
|
||||
// Also remove the base directory if empty
|
||||
// Also remove the base directory
|
||||
const worktreeBase = getSessionPath(options.sessionName);
|
||||
try {
|
||||
await runCommand(["rmdir", worktreeBase]);
|
||||
await runCommand(["rm", "-rf", worktreeBase]);
|
||||
} catch {
|
||||
// Ignore errors if directory not empty
|
||||
// Ignore errors
|
||||
}
|
||||
|
||||
cleanupPerformed = worktreesRemoved.length > 0;
|
||||
|
||||
Reference in New Issue
Block a user