diff --git a/apps/desktop/electron/find-git-bash.test.ts b/apps/desktop/electron/find-git-bash.test.ts index a8aa28ffb87e..63e00b3c3d68 100644 --- a/apps/desktop/electron/find-git-bash.test.ts +++ b/apps/desktop/electron/find-git-bash.test.ts @@ -14,6 +14,7 @@ test('HERMES_GIT_BASH_PATH override takes precedence', () => { fileExists: yes, findOnPath: () => null }) + assert.equal(result, 'D:\\CustomGit\\bin\\bash.exe') }) @@ -37,6 +38,7 @@ test('HERMES_GIT_BASH_PATH empty string is ignored', () => { fileExists: no, findOnPath: () => 'C:\\msys64\\usr\\bin\\bash.exe' }) + assert.equal(result, 'C:\\msys64\\usr\\bin\\bash.exe') }) @@ -47,5 +49,6 @@ test('non-Windows uses findOnPath', () => { fileExists: no, findOnPath: () => '/usr/bin/bash' }) + assert.equal(result, '/usr/bin/bash') }) diff --git a/apps/desktop/electron/find-git-bash.ts b/apps/desktop/electron/find-git-bash.ts index a862c5f872fe..62369e9bad6d 100644 --- a/apps/desktop/electron/find-git-bash.ts +++ b/apps/desktop/electron/find-git-bash.ts @@ -25,7 +25,10 @@ export function findGitBash(opts: GitBashOptions): string | null { // Respect HERMES_GIT_BASH_PATH if set (mirrors tools/environments/local.py:_find_bash). const gitBashPath = env.HERMES_GIT_BASH_PATH - if (gitBashPath && fileExists(gitBashPath)) return gitBashPath + + if (gitBashPath && fileExists(gitBashPath)) { + return gitBashPath + } const localAppData = env.LOCALAPPDATA || '' const candidates: string[] = [] @@ -47,12 +50,17 @@ export function findGitBash(opts: GitBashOptions): string | null { } for (const candidate of candidates) { - if (fileExists(candidate)) return candidate + if (fileExists(candidate)) { + return candidate + } } if (findOnPath) { const onPath = findOnPath('bash') - if (onPath) return onPath + + if (onPath) { + return onPath + } } return null