-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] default to stderr if available #13730
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
Conversation
I'd like to disagree, because that aren't errors. "Bug fix? Yes" -- which one? 😕 |
|
Primary I don't understand, what this PR solves. If you want to redirect the output you are usually not interested in a progress bar and interaction at all and so I'd expect Also I think that some tools (in my opinion) misuse [1] For example |
Take this for instance:
cURL will now (correctly) prompt for the password on The Unix philosophy where you have specialized, simple command line tools is about building pipelines. You can only build pipelines if your |
What about Should there also be |
While it might be convenient, I do think it should be up to the user to use the proper output (stdout vs. stderr) when calling |
Chris Fidao explains this quite well also http://fideloper.com/laravel-symfony-console-commands-stderr |
Thanks, nice link :-). |
👍 |
I wouldn't change this in 2.3 but only in 2.7/2.8 as it might have side effects. Also in later version there are alot more classes that would need to be adjusted as well like the ProgressBar class to be consistent. Also I feel this is the developers task to pass the correct output to these classes. It's not the responsibility of the classes to magically use a different output. It goes against the single responsibility principle. |
Aye, there is something to be said for that as well. I think it would help convention if stderr was the default, but it would certainly be nice if this could still be switched out for stdout instead. Not sure how to resolve that approach properly though. Thoughts? |
Many people do not know the history of unix file descriptors and best practices, so it is not clear that stderr should be used for informational messages. Considering that, we might want to reconsider this PR. @Seldaek what do you think? |
@Tobion well, IMO there are literally no reasons to ever write a question or interactive thing on STDOUT, so I don't really see it as a problem either way to default to the right thing (STDERR), and yes if you really want to force it to be STDOUT you can still do it as you say. |
@alcohol can you create a new PR please? |
With the same approach? (sorry I was not following the latest additions to the discussion) |
This one could just be reopened/merged no? |
Yes same approach. Cannot be reopened because repo was deleted. |
I don't have my fork anymore. So no... |
https://patch-diff.githubusercontent.com/raw/symfony/symfony/pull/13730.patch should ease the work ;) |
Do you still want me to base this off of 2.3 though? |
This PR was squashed before being merged into the 2.3 branch (closes #15794). Discussion ---------- [Console] default to stderr in the console helpers Interactive input/output and informational output such as progress should go to `stderr` if available. | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | See #13730 also for previous discussion. If someone explicitly wants to use `stdout`, they can simply pass `$output->getStream()` instead of `$output` in most use-cases. Commits ------- 3d4e95e [Console] default to stderr in the console helpers
[Console]
Interactive input/output and informational output such as progress should go to
stderr
if available./cc @Seldaek @dzuelke