test: isolate bash PTY tests from the host ~/.bashrc - #3173
Merged
Conversation
The bash arm of `exec_in_pty_shell` was the only shell arm without rc-file isolation: zsh sets ZDOTDIR=/dev/null + --no-rcs, nu sets --no-config-file, and the sibling `exec_bash_truly_interactive` already passes --norc --noprofile. Because the PTY harness sets HOME to the real home, interactive `bash -i` sourced the host's ~/.bashrc, leaking host-specific startup output into the captured snapshots. Add --norc --noprofile to the bash arm, mirroring the zsh/nu arms and `exec_bash_truly_interactive`. It's orthogonal to job control (driven by -i), so the job-control leak-detection tests still exercise the interactive path, and it's a no-op for the non-interactive `bash -c` path used by test_source_flag_forwards_errors. Follow-up to #3161 / #3165, which fixed the macOS PTY-test hang and isolated several other tests but left this arm untouched. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
worktrunk-bot
approved these changes
Jun 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The bash arm of
exec_in_pty_shell(tests/integration_tests/shell_wrapper.rs) was the only shell arm without rc-file isolation. zsh setsZDOTDIR=/dev/null+--no-rcs, nu sets--no-config-file, and the siblingexec_bash_truly_interactivealready passes--norc --noprofile— but the bash arm did not. Because the PTY harness setsHOMEto the real home, interactivebash -isourced the host's~/.bashrc, leaking host-specific startup output into the captured PTY snapshots.Fix
Add
--norc --noprofileto the bash arm, mirroring the zsh/nu arms andexec_bash_truly_interactive. It's orthogonal to job control (that's driven by-i), so the job-control leak-detection tests (test_*_no_job_control*) still exercise the interactive path; it's a no-op for the non-interactivebash -cpath used bytest_source_flag_forwards_errors.Follow-up to #3161 / #3165, which fixed the macOS PTY-test hang and isolated several other tests but left this arm untouched.
Tests
All 88
shell_wrappertests pass, plus the full pre-merge gate (4102 tests, all lints and doctests).