Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Merged

Conversation

@chalasr
Copy link
Member

@chalasrchalasr commentedNov 25, 2016
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed ticketsn/a
LicenseMIT
Doc PRn/a

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 aSymfonyStyle::getErrorStyle() shortcut for easily switching to stderr.

ogizanagi reacted with thumbs up emoji
@ogizanagi
Copy link
Contributor

Isn't there a lot more than those 4 commands? What aboutLintCommand for instance? :)

(I guess keeping this in#20586 would be less painful to update as you target master too for this bug fix 😅)

@chalasrchalasrforce-pushed theframework/use_stderr_in_commands branch fromb7af8c5 tob2920e7CompareNovember 25, 2016 18:28
@chalasr
Copy link
MemberAuthor

@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 theTwigLintCommand which makes use ofSymfonyStyle::error, because the output is intended to be redirected, but at the moment I don't see more commands to update.

I guess keeping this in#20586 would be less painful to update

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 :)

@chalasrchalasrforce-pushed theframework/use_stderr_in_commands branch fromb2920e7 to2207831CompareNovember 25, 2016 18:41
@chalasr
Copy link
MemberAuthor

Note that when exceptions are thrown (which is the case in lot of commands including lint ones), the output goes to stderr naturally.

@ogizanagi
Copy link
Contributor

@chalasr : I may have found some other places where it'll be relevant. See#20674

@chalasr
Copy link
MemberAuthor

Oh, I could have did it here if you just said me.. but ok then

@ogizanagi
Copy link
Contributor

ogizanagi commentedNov 28, 2016
edited
Loading

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.');
Copy link
Contributor

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?

Copy link
Contributor

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

Copy link
MemberAuthor

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?

Copy link
Contributor

@ogizanagiogizanagiNov 28, 2016
edited
Loading

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.

Copy link
Contributor

@ogizanagiogizanagiJan 7, 2017
edited
Loading

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. ^^

Copy link
MemberAuthor

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
Copy link
MemberAuthor

Having two places to discuss/review/merge about the same thing looks not simpler to me, as you wish.

@ogizanagi
Copy link
Contributor

Apply the patch then and I'll close mine.

@chalasr
Copy link
MemberAuthor

Done2af000a

@nicolas-grekasnicolas-grekas added this to the3.x milestoneDec 6, 2016
@nicolas-grekasnicolas-grekas added Feature and removed Bug labelsDec 6, 2016
@nicolas-grekas
Copy link
Member

👍

@chalasrchalasrforce-pushed theframework/use_stderr_in_commands branch 6 times, most recently from8ddb044 to6eaaf28CompareJanuary 6, 2017 21:42
@chalasr
Copy link
MemberAuthor

chalasr commentedJan 6, 2017
edited
Loading

Updated for usinggetErrorStyle() in the FrameworkBundle (as it requires the console to be~3.3) and fixed the WebServerBundle commands.


if (null ===$twig =$this->getTwigEnvironment()) {
$io->error('The Twig environment needs to be set.');
$io->getErrorStyle()->error('The Twig environment needs to be set.');
Copy link
Member

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.

Copy link
MemberAuthor

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();
Copy link
Member

Choose a reason for hiding this comment

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

same here

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Reverted everywhere

Copy link
MemberAuthor

@chalasrchalasrJan 12, 2017
edited
Loading

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

ogizanagi reacted with thumbs up emoji
protectedfunctionexecute(InputInterface$input,OutputInterface$output)
{
$io =newSymfonyStyle($input,$output);
$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.

and the same also applies to the SecurityBundle

Copy link
MemberAuthor

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?

@chalasrchalasrforce-pushed theframework/use_stderr_in_commands branch 5 times, most recently frombebd602 tob64fe2dCompareJanuary 8, 2017 10:37
@chalasr
Copy link
MemberAuthor

Build failure unrelated (see#21198)

@chalasrchalasrforce-pushed theframework/use_stderr_in_commands branch fromb64fe2d to462a6f5CompareJanuary 10, 2017 17:16
@chalasr
Copy link
MemberAuthor

chalasr commentedJan 10, 2017
edited
Loading

Rebased, tests are green. This is ready

@chalasrchalasrforce-pushed theframework/use_stderr_in_commands branch 5 times, most recently from1b327f5 to201bb4aCompareJanuary 12, 2017 17:33
@chalasrchalasrforce-pushed theframework/use_stderr_in_commands branch from201bb4a to7b262d8CompareJanuary 12, 2017 20:28
@chalasr
Copy link
MemberAuthor

ping

Copy link
Member

@xabbuhxabbuh left a comment

Choose a reason for hiding this comment

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

👍

@fabpot
Copy link
Member

Thank you@chalasr.

@fabpotfabpot merged commit7b262d8 intosymfony:masterFeb 19, 2017
fabpot added a commit that referenced this pull requestFeb 19, 2017
…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
@chalasrchalasr deleted the framework/use_stderr_in_commands branchFebruary 20, 2017 05:55
@nicolas-grekasnicolas-grekas modified the milestones:3.x,3.3Mar 24, 2017
@fabpotfabpot mentioned this pull requestMay 1, 2017
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@xabbuhxabbuhxabbuh approved these changes

+1 more reviewer

@ogizanagiogizanagiogizanagi left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

3.3

Development

Successfully merging this pull request may close these issues.

6 participants

@chalasr@ogizanagi@nicolas-grekas@fabpot@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp