Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[FrameworkBundle] Make use of stderr for non reliable output#20632
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
1eac2be tob7af8c5Compareogizanagi commentedNov 25, 2016
Isn't there a lot more than those 4 commands? What about (I guess keeping this in#20586 would be less painful to update as you target master too for this bug fix 😅) |
b7af8c5 tob2920e7Comparechalasr commentedNov 25, 2016
@ogizanagi I made the changes only where it makes sense in my opinion, which exclude commands where the output give no relevant information at all. I just applied it on the
Not that much, each one can be merged independently and, since the subject of#20586 was "Add getErrorIo AND use stderr in existing commands", I do think it should be done in two PRs :) |
b2920e7 to2207831Comparechalasr commentedNov 25, 2016
Note that when exceptions are thrown (which is the case in lot of commands including lint ones), the output goes to stderr naturally. |
ogizanagi commentedNov 28, 2016
chalasr commentedNov 28, 2016
Oh, I could have did it here if you just said me.. but ok then |
ogizanagi commentedNov 28, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I had to check relevant places myself so it was simpler to submit it 😅 |
| if (null ===$twig =$this->getTwigEnvironment()) { | ||
| $io->error('The Twig environment needs to be set.'); | ||
| $errorIo =$outputinstanceof ConsoleOutputInterface ?newSymfonyStyle($input,$output->getErrorOutput()) :$io; | ||
| $errorIo->error('The Twig environment needs to be set.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I'd challenge this one in order to simply throw a\RuntimeException instead. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
BTW, I've reverted a similar change in my previous PR thinking it was the same, but actually it's another place:https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Twig/Command/DebugCommand.php#L90
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Sure 👍 but should it be done here?
ogizanagiNov 28, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
As it slightly changes the output and is done mainly in the aim to output it to stderr more straightforwardly, I'd say yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
The Twig Bridge DebugCommand update is still missing here, even in case the suggestion about throwing an exception instead is not considered. ^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Both debug/lint commands have been updated :)
chalasr commentedNov 28, 2016
Having two places to discuss/review/merge about the same thing looks not simpler to me, as you wish. |
ogizanagi commentedNov 28, 2016
Apply the patch then and I'll close mine. |
chalasr commentedNov 28, 2016
Done2af000a |
nicolas-grekas commentedJan 6, 2017
👍 |
8ddb044 to6eaaf28Comparechalasr commentedJan 6, 2017 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Updated for using |
| if (null ===$twig =$this->getTwigEnvironment()) { | ||
| $io->error('The Twig environment needs to be set.'); | ||
| $io->getErrorStyle()->error('The Twig environment needs to be set.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This will fail when the bridge is used with older versions (before 3.3) of the Console component which is completely valid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Reverted
| protectedfunctionexecute(InputInterface$input,OutputInterface$output) | ||
| { | ||
| $io =newSymfonyStyle($input,$output); | ||
| $errorIo =$io->getErrorStyle(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Reverted everywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@xabbuh The framework now has a conflict forsymfony/console: <3.3 so it should be fine
| protectedfunctionexecute(InputInterface$input,OutputInterface$output) | ||
| { | ||
| $io =newSymfonyStyle($input,$output); | ||
| $errorIo =$io->getErrorStyle(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
and the same also applies to the SecurityBundle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Would it work (and make sense) to add a conflict with older versions of the Console?
bebd602 tob64fe2dComparechalasr commentedJan 8, 2017
Build failure unrelated (see#21198) |
b64fe2d to462a6f5Comparechalasr commentedJan 10, 2017 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Rebased, tests are green. This is ready |
1b327f5 to201bb4aCompare201bb4a to7b262d8Comparechalasr commentedJan 30, 2017
ping |
xabbuh left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
👍
fabpot commentedFeb 19, 2017
Thank you@chalasr. |
…output (chalasr, ogizanagi)This PR was merged into the 3.3-dev branch.Discussion----------[FrameworkBundle] Make use of stderr for non reliable output| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | n/a| License | MIT| Doc PR | n/aBuilt-in commands should make use of the proper outputs.As a feature on master, considering that people may actually rely on stdout and the fact commands have been changed a lot since 2.7, I think it's not worth doing this change on lower branches.Please see also#20586 which adds a `SymfonyStyle::getErrorStyle()` shortcut for easily switching to stderr.Commits-------7b262d8 [FrameworkBundle] Use getErrorStyle() when relevant9a3a568 Use stderr for some other commands1ee48bf [FrameworkBundle] Make use of stderr for non reliable output
Uh oh!
There was an error while loading.Please reload this page.
Built-in commands should make use of the proper outputs.
As a feature on master, considering that people may actually rely on stdout and the fact commands have been changed a lot since 2.7, I think it's not worth doing this change on lower branches.
Please see also#20586 which adds a
SymfonyStyle::getErrorStyle()shortcut for easily switching to stderr.