[Bash] Fix Windows cookbook background tasks (#676)

* Fix Windows cookbook background tasks

* Add Windows Cookbook reliability follow-ups
This commit is contained in:
hawktuahs
2026-06-04 09:00:01 +05:30
committed by GitHub
parent 0f7ea7a936
commit 3d8c364689
7 changed files with 153 additions and 32 deletions

View File

@@ -171,6 +171,15 @@ def _windows_bash_fallbacks() -> List[str]:
return paths
def _is_windows_bash_stub(path: str) -> bool:
lowered = path.lower()
return (
"system32\\bash.exe" in lowered
or "sysnative\\bash.exe" in lowered
or "windowsapps\\bash.exe" in lowered
)
def find_bash() -> Optional[str]:
"""Locate a real ``bash`` interpreter, or None.
@@ -184,6 +193,8 @@ def find_bash() -> Optional[str]:
return _BASH_CACHE
_BASH_PROBED = True
found = which_tool("bash")
if found and IS_WINDOWS and _is_windows_bash_stub(found):
found = None
if not found and IS_WINDOWS:
for cand in _windows_bash_fallbacks():
if os.path.exists(cand):