fix(env): pass -- to cd for hyphen-prefixed workdirs

This commit is contained in:
Yoimex 2026-04-25 07:56:29 +03:00 committed by Teknium
parent ae40fca955
commit edf9c75621
2 changed files with 16 additions and 8 deletions

View file

@ -405,7 +405,8 @@ class BaseEnvironment(ABC):
# Preserve bare ``~`` expansion, but rewrite ``~/...`` through
# ``$HOME`` so suffixes with spaces remain a single shell word.
quoted_cwd = self._quote_cwd_for_cd(cwd)
parts.append(f"builtin cd {quoted_cwd} || exit 126")
# ``--`` keeps hyphen-prefixed directory names from being parsed as options.
parts.append(f"builtin cd -- {quoted_cwd} || exit 126")
# Run the actual command
parts.append(f"eval '{escaped}'")