From 6c2c866a9ae3a20ee5e7adcd3cc6bf6778b28a58 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Thu, 23 Jul 2026 12:19:11 -0700 Subject: [PATCH] fix(desktop): join Windows bash candidates with path.win32 in find-git-bash The extracted findGitBash builds Windows-style candidate paths, but the vitest suite (and any POSIX CI host) runs with posix path.join, which mangles 'C:\Program Files' + segments into slash-joined paths and broke the invalid-override fallback test. Use path.win32.join explicitly so candidate construction is host-independent. --- apps/desktop/electron/find-git-bash.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/desktop/electron/find-git-bash.ts b/apps/desktop/electron/find-git-bash.ts index 1e525aebc563..a862c5f872fe 100644 --- a/apps/desktop/electron/find-git-bash.ts +++ b/apps/desktop/electron/find-git-bash.ts @@ -30,16 +30,20 @@ export function findGitBash(opts: GitBashOptions): string | null { const localAppData = env.LOCALAPPDATA || '' const candidates: string[] = [] + // Candidate paths are Windows paths regardless of host platform (tests run + // on POSIX CI hosts too), so join with win32 semantics explicitly. + const joinWin = path.win32.join + if (localAppData) { - candidates.push(path.join(localAppData, 'hermes', 'git', 'bin', 'bash.exe')) - candidates.push(path.join(localAppData, 'hermes', 'git', 'usr', 'bin', 'bash.exe')) + candidates.push(joinWin(localAppData, 'hermes', 'git', 'bin', 'bash.exe')) + candidates.push(joinWin(localAppData, 'hermes', 'git', 'usr', 'bin', 'bash.exe')) } - candidates.push(path.join(env['ProgramFiles'] || 'C:\\Program Files', 'Git', 'bin', 'bash.exe')) - candidates.push(path.join(env['ProgramFiles(x86)'] || 'C:\\Program Files (x86)', 'Git', 'bin', 'bash.exe')) + candidates.push(joinWin(env['ProgramFiles'] || 'C:\\Program Files', 'Git', 'bin', 'bash.exe')) + candidates.push(joinWin(env['ProgramFiles(x86)'] || 'C:\\Program Files (x86)', 'Git', 'bin', 'bash.exe')) if (localAppData) { - candidates.push(path.join(localAppData, 'Programs', 'Git', 'bin', 'bash.exe')) + candidates.push(joinWin(localAppData, 'Programs', 'Git', 'bin', 'bash.exe')) } for (const candidate of candidates) {