From 5330b2cfade28e48e608beb0a286c8646305f137 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Thu, 16 Jul 2026 01:00:57 -0700 Subject: [PATCH] fix: use Windows-aware isabs for native paths under patched _IS_WINDOWS Follow-up for salvaged PR #26790: on a POSIX host with _IS_WINDOWS patched (test simulation), os.path.isabs rejects C:\Users\x and the new relative-cwd recovery would mangle a perfectly absolute native Windows path. Check ntpath.isabs first on the Windows branch. --- tools/environments/local.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/environments/local.py b/tools/environments/local.py index acb390df4d9b..e18d1a7bd1f5 100644 --- a/tools/environments/local.py +++ b/tools/environments/local.py @@ -63,6 +63,12 @@ def _resolve_local_initial_cwd(cwd: str) -> str: expanded = os.path.expanduser(cwd) if cwd else os.getcwd() if _IS_WINDOWS: expanded = _msys_to_windows_path(expanded) + # Use the Windows-aware check explicitly: when _IS_WINDOWS is + # patched in tests on a POSIX host, os.path.isabs would reject + # ``C:\Users\x`` and mangle it through the relative branch. + import ntpath + if ntpath.isabs(expanded): + return expanded if os.path.isabs(expanded): return expanded