From 5472ea4048340ca6aeb74cbe558b66904738e21c Mon Sep 17 00:00:00 2001 From: mirivlad Date: Mon, 23 Feb 2026 16:15:46 +0800 Subject: [PATCH] Fix cd parsing for compound commands Co-authored-by: Qwen-Coder --- bot.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bot.py b/bot.py index a34d18e..eaad6d5 100644 --- a/bot.py +++ b/bot.py @@ -654,8 +654,10 @@ async def execute_cli_command_from_message(update: Update, command: str): working_dir = state.working_directory or config.get("working_directory", str(Path.home())) # Обработка команды cd - меняем директорию пользователя - if command.strip().startswith("cd "): - parts = command.strip().split(maxsplit=1) + # Работает только с простыми командами cd, не с составными + cmd_stripped = command.strip() + if cmd_stripped.startswith("cd ") and "&&" not in cmd_stripped and ";" not in cmd_stripped and "|" not in cmd_stripped: + parts = cmd_stripped.split(maxsplit=1) if len(parts) == 2: target_dir = parts[1]