KEMBAR78
extend/kernel: restore user `TERM` in interactive shell by ZhongRuoyu · Pull Request #20748 · Homebrew/brew · GitHub
Skip to content

Conversation

ZhongRuoyu
Copy link
Member

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

formula.rb currently overrides TERM to "dumb" in the test environment, which is sensible for non-interactive tests. However, when running in debug mode and dropping into an interactive shell, leaving TERM as "dumb" breaks terminal capabilities, causing weird behaviour like making prompt disappear at times. To avoid this, restore the user's original TERM when starting an interactive shell. This also matches the build environment where we don't override TERM to "dumb".

formula.rb currently overrides `TERM` to "dumb" in the test environment,
which is sensible for non-interactive tests. However, when running in
debug mode and dropping into an interactive shell, leaving `TERM` as
"dumb" breaks terminal capabilities, causing weird behaviour like making
prompt disappear at times. To avoid this, restore the user's original
`TERM` when starting an interactive shell. This also matches the build
environment where we don't override `TERM` to "dumb".
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! One suggested tweak.

Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Sep 22, 2025
Merged via the queue into main with commit 0f26150 Sep 22, 2025
38 checks passed
@MikeMcQuaid MikeMcQuaid deleted the test-user-term branch September 22, 2025 14:25
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.

2 participants