Skip to content

Commit 85611de

Browse files
brookscclaude
andcommitted
fix(git): guard getWorktreeStatus against deleted worktree path
When the coordinator closes, its worktree directory is deleted before the frontend stops polling get_worktree_status. exec('git', ..., { cwd }) throws ENOENT (misleadingly reported as 'spawn git ENOENT') when the cwd no longer exists. Return a safe empty result instead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 24c4569 commit 85611de

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

electron/ipc/git.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,6 +1352,9 @@ export async function getWorktreeStatus(
13521352
has_uncommitted_changes: boolean;
13531353
current_branch: string | null;
13541354
}> {
1355+
if (!fs.existsSync(worktreePath)) {
1356+
return { has_committed_changes: false, has_uncommitted_changes: false, current_branch: null };
1357+
}
13551358
const { stdout: statusOut } = await exec('git', ['status', '--porcelain'], {
13561359
cwd: worktreePath,
13571360
maxBuffer: MAX_BUFFER,

0 commit comments

Comments
 (0)