Fix cd parsing for compound commands
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
parent
8070762310
commit
5472ea4048
6
bot.py
6
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]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue