fix(terminal): set MSYS_NO_PATHCONV for Windows Git Bash subprocesses
Git Bash mangles native Windows command flags (/FO, /TN, /Create) into bogus paths. Hermes terminal and background spawns now opt out by default so tasklist, schtasks, and wmic work without manual prefixes. Fixes #56700.
This commit is contained in:
parent
a9b5598909
commit
cc2abd570b
1 changed files with 21 additions and 0 deletions
|
|
@ -383,6 +383,8 @@ def _sanitize_subprocess_env(base_env: dict | None, extra_env: dict | None = Non
|
|||
for _marker in _ACTIVE_VENV_MARKER_VARS:
|
||||
sanitized.pop(_marker, None)
|
||||
|
||||
_apply_windows_msys_bash_env_defaults(sanitized)
|
||||
|
||||
return sanitized
|
||||
|
||||
|
||||
|
|
@ -493,6 +495,8 @@ def hermes_subprocess_env(*, inherit_credentials: bool = False) -> dict[str, str
|
|||
for _marker in _ACTIVE_VENV_MARKER_VARS:
|
||||
env.pop(_marker, None)
|
||||
|
||||
_apply_windows_msys_bash_env_defaults(env)
|
||||
|
||||
# Cross-session leak guard, same as the terminal spawn paths: this helper
|
||||
# copies os.environ, whose HERMES_SESSION_* mirror is a last-writer-wins
|
||||
# global under a concurrent multi-session host. A caller that re-binds the
|
||||
|
|
@ -746,6 +750,21 @@ def _append_missing_sane_path_entries(existing_path: str) -> str:
|
|||
return ":".join(ordered_entries)
|
||||
|
||||
|
||||
def _apply_windows_msys_bash_env_defaults(env: dict) -> None:
|
||||
"""Disable MSYS argument path conversion for Git Bash subprocesses.
|
||||
|
||||
Git Bash rewrites arguments that look like Unix paths (``/FO``, ``/TN``,
|
||||
``/Create``) into ``C:/.../git/FO``-style paths, which breaks native
|
||||
Windows commands such as ``tasklist``, ``schtasks``, and ``wmic``. Hermes
|
||||
runs terminal commands through bash on Windows, so set the standard MSYS
|
||||
opt-out by default. Users who need conversion can override in their env.
|
||||
Refs #56700.
|
||||
"""
|
||||
if not _IS_WINDOWS:
|
||||
return
|
||||
env.setdefault("MSYS_NO_PATHCONV", "1")
|
||||
|
||||
|
||||
def _path_env_key(run_env: dict) -> str | None:
|
||||
"""Return the PATH env key to update without altering Windows casing.
|
||||
|
||||
|
|
@ -804,6 +823,8 @@ def _make_run_env(env: dict) -> dict:
|
|||
for _marker in _ACTIVE_VENV_MARKER_VARS:
|
||||
run_env.pop(_marker, None)
|
||||
|
||||
_apply_windows_msys_bash_env_defaults(run_env)
|
||||
|
||||
return run_env
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue