mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-20 15:33:54 +00:00
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.
This commit is contained in:
parent
5458c76566
commit
5330b2cfad
1 changed files with 6 additions and 0 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue