Skip to content

fix: keep run and test commands in the requested cwd#5348

Open
rodboev wants to merge 1 commit into
Aider-AI:mainfrom
rodboev:pr/run-cwd-rc
Open

fix: keep run and test commands in the requested cwd#5348
rodboev wants to merge 1 commit into
Aider-AI:mainfrom
rodboev:pr/run-cwd-rc

Conversation

@rodboev

@rodboev rodboev commented Jun 29, 2026

Copy link
Copy Markdown

/run and /test already pass aider's selected cwd into run_cmd(), but the pexpect path starts the shell with -i -c. Interactive startup files run first, so a .bashrc with cd ... can move the command before it executes.

This keeps the existing pexpect streaming path, but runs shell commands with -c instead of -i -c so the requested cwd remains authoritative.

Closes #4270

Issue #4270's .bashrc cd reproduction shaped the regression test for this fix.

Tests:

  • rtk python -m pytest tests/basic/test_run_cmd.py -v
  • rtk pre-commit run --all-files

Latest run:

  • rtk python -m pytest tests/basic/test_run_cmd.py -v: passed
  • rtk pre-commit run --all-files: passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/run & /test commands use wrong CWD if .bashrc contains "cd" (due to pexpect interactive shell)

1 participant