Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Console] Styles do not respect stderr #15986

Closed
Tobion opened this issue Sep 28, 2015 · 1 comment
Closed

[Console] Styles do not respect stderr #15986

Tobion opened this issue Sep 28, 2015 · 1 comment

Comments

@Tobion
Copy link
Contributor

Tobion commented Sep 28, 2015

The problem is that Styles like the SymfonyStyle do not use stderr when appropriate.
Errors and diagnostic and interactive messages that are not meant as actual ouput of the command should go to stderr. For background info see http://www.jstorimer.com/blogs/workingwithcode/7766119-when-to-use-stderr-instead-of-stdout

For this we merged #15795 to help people use the right one by default. But this will not take effect when using the styles currently, e.g. when using askQuestion in https://github.com/symfony/symfony/blob/2.8/src/Symfony/Component/Console/Style/SymfonyStyle.php#L330

@SpacePossum
Copy link
Contributor

The problem is that Styles like the SymfonyStyle do not use stderr when appropriate.

Is it by design that a formatter chooses a stream, i.e. does more than formatting?
For example, how would you write an error through a formatter to stdout?
Binding a formatter two both streams (through ConsoleOutput::setFormatter) at the same time is pretty confusing, if the formatters are going to switch between streams as well it will become even more confusing where output ends up IMHO.

@fabpot fabpot closed this as completed Jan 6, 2017
fabpot added a commit that referenced this issue Jan 6, 2017
…halasr)

This PR was merged into the 3.3-dev branch.

Discussion
----------

[Console] Ease writing to stderr using SymfonyStyle

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #15986
| License       | MIT
| Doc PR        | n/a

Commits
-------

5b0504c [Console] Ease writing to stderr using styles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants