|
|
@@ -73,9 +73,11 @@ def run_bash(input_val: Any) -> str:
|
|
|
working_dir = params.get("working_dir", "") or _get_cwd()
|
|
|
background = params.get("run_in_background", False)
|
|
|
|
|
|
- # Handle cd commands — update session CWD
|
|
|
+ # Handle pure cd commands — update session CWD
|
|
|
+ # Only intercept simple "cd <path>", not chained commands like "cd x && git init"
|
|
|
stripped = command.strip()
|
|
|
- if stripped.startswith("cd "):
|
|
|
+ is_pure_cd = stripped.startswith("cd ") and not any(op in stripped for op in ["&&", "||", ";", "|", "\n"])
|
|
|
+ if is_pure_cd:
|
|
|
target = stripped[3:].strip().strip("'\"")
|
|
|
if not os.path.isabs(target):
|
|
|
target = os.path.join(working_dir, target)
|