From 435d86ce36b6ca243fab16c2987a00bbe9795e3f Mon Sep 17 00:00:00 2001 From: Konstantinos Karachalios Date: Tue, 14 Apr 2026 10:18:11 +0200 Subject: [PATCH] fix: use builtin cd in command wrapper to bypass shell aliases Version managers like frum (Ruby), rvm, nvm, and others commonly alias cd to a wrapper function that runs additional logic after directory changes. When Hermes captures the shell environment into a session snapshot, these aliases are preserved. If the wrapper function fails in the subprocess context (e.g. frum not on PATH), every cd fails, causing all terminal commands to exit with code 126. Using builtin cd bypasses any aliases or functions, ensuring the directory change always uses the real bash builtin regardless of what version managers are installed. --- tools/environments/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/environments/base.py b/tools/environments/base.py index 19a637901..d89b66f19 100644 --- a/tools/environments/base.py +++ b/tools/environments/base.py @@ -383,7 +383,7 @@ class BaseEnvironment(ABC): quoted_cwd = ( shlex.quote(cwd) if cwd != "~" and not cwd.startswith("~/") else cwd ) - parts.append(f"cd {quoted_cwd} || exit 126") + parts.append(f"builtin cd {quoted_cwd} || exit 126") # Run the actual command parts.append(f"eval '{escaped}'")