Skip to content

Conversation

@wazum
Copy link
Contributor

@wazum wazum commented Oct 27, 2025

Q A
Branch? 6.4
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #60822
License MIT

Fixes Messenger commands incorrectly routing all output to STDERR, preventing proper piping and redirection of structured data.

Updated commands to follow the established Symfony pattern (e.g., TranslationUpdateCommand, ContainerLintCommand):

  • Create $io = new SymfonyStyle($input, $output) for primary output → STDOUT
  • Create $errorIo = $io->getErrorStyle() for diagnostics → STDERR

STDOUT (parseable data):

  • Tables (message lists, statistics)
  • Counts ("There are X messages pending")
  • Success messages
  • Structured output

STDERR (supplementary info):

  • Errors and warnings
  • Informational comments/hints
  • Interactive prompts and confirmations

{
$errorIo ??= $io->getErrorStyle();
Copy link
Member

Choose a reason for hiding this comment

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

since $errorIo is always derived from $io->getErrorStyle(), I'd rather remove all the extra arguments added to method. That'd work, isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nicolas-grekas that would work, but creates new instances. Just tell me what you prefer, and I'll adjust the code accordingly. Thanks for the feedback.

@OskarStark OskarStark changed the title [Messenger] Fix commands writing to STDERR instead of STDOUT [Messenger] Fix commands writing to STDERR instead of STDOUT Nov 5, 2025
Messenger commands were using getErrorOutput() for all output, causing
structured data (tables, messages) to go to STDERR instead of STDOUT.

Fixes symfony#60822
@nicolas-grekas nicolas-grekas force-pushed the bugfix/messenger-commands-stderr-60822 branch from e1318d2 to 8c52edd Compare November 6, 2025 11:00
@nicolas-grekas
Copy link
Member

Thank you @wazum.

@nicolas-grekas nicolas-grekas merged commit 4116def into symfony:6.4 Nov 6, 2025
8 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants