Skip to content

fix: use stderr=True for rich.Console#155

Merged
petereon merged 1 commit intopetereon:masterfrom
slqy123:fix/stderr_output
Jan 8, 2026
Merged

fix: use stderr=True for rich.Console#155
petereon merged 1 commit intopetereon:masterfrom
slqy123:fix/stderr_output

Conversation

@slqy123
Copy link
Copy Markdown
Contributor

@slqy123 slqy123 commented Jan 8, 2026

Currently, the output of rich console is set to stdout. This causes some issues when stdout is redirected.

To reproduce this issue, run the following code with python test.py | grep 1, since all escape codes are sent to the redirection target (grep) instead of the user's terminal, nothing will be rendered

from beaupy import select
choices = ["1", "2", "3"]
print(select(choices))

This pr add stderr=True for rich.Console, and add the missing console=console for qselect and qprompt.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an issue where interactive CLI elements fail to render properly when stdout is redirected. The fix changes the rich Console to use stderr instead of stdout, which is the standard practice for interactive terminal UI elements. Additionally, the PR ensures that all interactive prompt and select elements receive the console parameter so they consistently use stderr.

Key Changes

  • Modified the global Console instance to output to stderr instead of stdout
  • Added console=console parameter to qprompt.Prompt, qselect.Select instances in prompt(), select(), and select_multiple() functions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@petereon petereon merged commit c331c75 into petereon:master Jan 8, 2026
20 of 23 checks passed
@petereon
Copy link
Copy Markdown
Owner

petereon commented Jan 8, 2026

Thank you for the contribution, it's much appreciated! I've merged and will release now.

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.

3 participants