fix(tools): _find_bash on Windows prefers Git Bash over WSL shell (#47837) - #50191
fix(tools): _find_bash on Windows prefers Git Bash over WSL shell (#47837)#50191lEWFkRAD wants to merge 2 commits into
Conversation
…usResearch#47837) On native Windows with both WSL and Git for Windows installed, shutil.which("bash") returned C:\Windows\System32\bash.exe (the WSL bridge process) before checking explicit Git paths. The WSL bridge does not support MSYS path translation so every Windows filesystem path fails with "No such file or directory". Approved approach per CONTRIBUTING.md cross-platform rules: - Check explicit C:\Program Files\Git\bin\bash.exe FIRST - Only fall back to shutil.which after that - Add "git" in path.lower() guard to reject WSL bridge Single-file change in tools/environments/local.py. No new deps.
|
Duplicate of #47920 — both fix #47837 by reordering |
Resolve _find_bash conflict: keep upstream's portable-Git (%LOCALAPPDATA%\hermes\git)
lookup, but drop the unconditional shutil.which("bash") early return that would
re-shadow Git Bash with WSL System32 bash.exe (issue NousResearch#47837). Explicit Program Files
Git paths remain checked before the guarded PATH fallback.
|
Closing: upstream ad5f334 (fix(terminal): prefer Git for Windows bash over Linux bash on Windows) has since landed on main and implements this same fix - explicit Git-for-Windows locations are now checked before the PATH lookup, and Hermes additionally prefers its own portable Git install. #47837 is covered; this PR is obsoleted. (Same reason the duplicate #47920 was closed.) |
What does this PR do?
On native Windows with both WSL and Git for Windows installed,
_find_bash()returnedC:\Windows\System32\bash.exe(the WSL bridge process) becauseshutil.which("bash")ran before checking explicit Git paths. The WSL bridge does not support MSYS path translation (/c/Users/...), so every Windows filesystem path fails with "No such file or directory".Fix: Reorder the resolution chain so explicit Git for Windows paths are checked first, then fall back to
shutil.which("bash")with a guard that only accepts paths containing "Git" in the directory components.Related Issue
Fixes #47837
Type of Change
Changes Made
tools/environments/local.py— moved explicit Git for Windows path candidates beforeshutil.which("bash")call; added"git" in found.lower()guard on the fallback PATH lookupHow to Test
hermes chat -q "run pwd"— should return a Windows path, not fail with "No such file or directory"_find_bash()resolves toC:\Program Files\Git\bin\bash.exenotC:\Windows\System32\bash.exeChecklist
_IS_WINDOWS