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

[Console] default to stderr in the console helpers#15794

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

Closed
alcohol wants to merge2 commits intosymfony:2.3fromalcohol:2.3-default-to-stderr
Closed

[Console] default to stderr in the console helpers#15794

alcohol wants to merge2 commits intosymfony:2.3fromalcohol:2.3-default-to-stderr

Conversation

@alcohol
Copy link
Contributor

Interactive input/output and informational output such as progress should go tostderr if available.

QA
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets
LicenseMIT
Doc PR

See#13730 also for previous discussion.

If someone explicitly wants to usestdout, they can simply pass$output->getStream() instead of$output in most use-cases.

Copy link
Contributor

Choose a reason for hiding this comment

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

this should be outside the loop

@Tobion
Copy link
Contributor

Could you create another PR against 2.7 that changesProgressBar andQuestionHelper accordingly please?

@alcohol
Copy link
ContributorAuthor

Yes already working on a PR for 2.7.

AreProgressBar andQuestionHelper the only ones eligible?
There is also aSymfonyQuestionHelper. I take it that is for internal stuff only then?

@Tobion
Copy link
Contributor

SymfonyQuestionHelper extends QuestionHelper and thus should be convered already

@alcohol
Copy link
ContributorAuthor

Please let me know if#15795 covers it or if any amendments need to be made.

@alcohol
Copy link
ContributorAuthor

@Seldaek here you go (again).

@Tobion
Copy link
Contributor

👍

Status: Reviewed

@stof
Copy link
Member

Tests covering this are missing

@alcohol
Copy link
ContributorAuthor

What would be an acceptable test scenario in your opinion, to validate these changes?

@stof
Copy link
Member

@alcohol Creating the helper with a ConsoleOutputInterface, and asserting that it writes its output to the error output.

@alcohol
Copy link
ContributorAuthor

Allright. Will implement something later today. Thanks for the feedback.

@Tobion
Copy link
Contributor

Status: Needs Work
Tests

@alcohol
Copy link
ContributorAuthor

@Tobion got any tips?

I tried the following for theDialogHelper for example, but yeah obviously it doesn't work as expected.

publicfunctiontestAskOnStderrWithConsoleOutput()    {if (!$this->hasSttyAvailable()) {$this->markTestSkipped('`stderr` is required to test stderr output functionality');        }$dialog =newDialogHelper();$dialog->setInputStream($this->getInputStream("\nnot stdout\n"));$this->assertEquals('stderr',$dialog->ask(newConsoleOutput(),'Where should output go?','stderr'));$this->assertEquals('not stdout',$dialog->ask($output =newConsoleOutput(),'Where should output go?','stderr'));rewind($output->getErrorOutput()->getStream());$this->assertEquals('Where should output go?',stream_get_contents($output->getErrorOutput()->getStream()));    }
/srv/git/github/symfony (2.3-default-to-stderr*) $ ./phpunit src/Symfony/Component/Console/Tests/Helper/DialogHelperTest.phpPHPUnit 4.8.9 by Sebastian Bergmann and contributors...F....Time: 236 ms, Memory: 6.00MbThere was 1 failure:1) Symfony\Component\Console\Tests\Helper\DialogHelperTest::testAskOnStderrWithConsoleOutputFailed asserting that two strings are equal.--- Expected+++ Actual@@ @@-'Where should output go?'+''/srv/git/github/symfony/src/Symfony/Component/Console/Tests/Helper/DialogHelperTest.php:81FAILURES!Tests: 7, Assertions: 35, Failures: 1.Where should output go?Where should output go?KO src/Symfony/Component/Console/Tests/Helper/DialogHelperTest.php

I noticed all the tests usephp://memory for output. Nothing actually ever testsstdout orstderr.

@alcohol
Copy link
ContributorAuthor

@Tobion,@stof, can you let me know if the above added tests are in line with what you in mind? I'll add more in that case.

fabpot added a commit that referenced this pull requestSep 22, 2015
… (alcohol)This PR was merged into the 2.7 branch.Discussion----------[Console] Default to stderr for the console helpers (2.7+)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        |Only merge if#15794 is merged.If someone explicitly wants to use `stdout`, they can simply pass `$output->getStream()` instead of `$output` in most use-cases.Commits-------90c2a96 Default to stderr for console helpers (only merge if#15794 gets merged)
nicolas-grekas added a commit that referenced this pull requestSep 22, 2015
* 2.7:  [Config] Fix enum default value in Yaml dumper  Finnish translation fix  [CssSelector] Optimize regexs matching simple selectors  Fix the phpdoc in the CssSelector TranslatorInterface  [Console] Add clock mock to fix transient test on HHVM  [DomCrawler] Optimize the regex used to find namespace prefixes  [EventDispatcher] skip one lazy loading call  [EventDispatcher] fix memory leak in a getListeners  Default to stderr for console helpers (only merge if#15794 gets merged)
nicolas-grekas added a commit that referenced this pull requestSep 22, 2015
* 2.8:  Added the right revision date for status code registry  [Config] Fix enum default value in Yaml dumper  fixed typo.  [Translation][File dumper] allow get file content without writing in file.  Finnish translation fix  [CssSelector] Optimize regexs matching simple selectors  Fix the phpdoc in the CssSelector TranslatorInterface  [Console] Add clock mock to fix transient test on HHVM  [DomCrawler] Optimize the regex used to find namespace prefixes  [VarDumper] Add EnumStub for dumping virtual collections with casters  [Finder] Deprecate adapters and related classes  [EventDispatcher] skip one lazy loading call  [EventDispatcher] fix memory leak in a getListeners  [WebProfilerBundle] added btn-link.  Remove duplication of the handling of regex filters in the Finder  Default to stderr for console helpers (only merge if#15794 gets merged)Conflicts:src/Symfony/Component/Console/Tests/Helper/LegacyProgressHelperTest.phpsrc/Symfony/Component/EventDispatcher/EventDispatcher.phpsrc/Symfony/Component/VarDumper/Tests/CliDumperTest.phpsrc/Symfony/Component/VarDumper/Tests/HtmlDumperTest.php
@keradus
Copy link
Member

Hi everyone !
Whan is the state of this PR ?

@alcohol
Copy link
ContributorAuthor

@keradus not sure, getting dusty? :d

@fabpot
Copy link
Member

Thank you@alcohol.

fabpot added a commit that referenced this pull requestMar 4, 2016
This PR was squashed before being merged into the 2.3 branch (closes#15794).Discussion----------[Console] default to stderr in the console helpersInteractive 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
@fabpotfabpot closed thisMar 4, 2016
@fabpotfabpot mentioned this pull requestMar 13, 2016
This was referencedMar 25, 2016
ostrolucky pushed a commit to ostrolucky/symfony that referenced this pull requestMar 25, 2018
* 2.8:  Added the right revision date for status code registry  [Config] Fix enum default value in Yaml dumper  fixed typo.  [Translation][File dumper] allow get file content without writing in file.  Finnish translation fix  [CssSelector] Optimize regexs matching simple selectors  Fix the phpdoc in the CssSelector TranslatorInterface  [Console] Add clock mock to fix transient test on HHVM  [DomCrawler] Optimize the regex used to find namespace prefixes  [VarDumper] Add EnumStub for dumping virtual collections with casters  [Finder] Deprecate adapters and related classes  [EventDispatcher] skip one lazy loading call  [EventDispatcher] fix memory leak in a getListeners  [WebProfilerBundle] added btn-link.  Remove duplication of the handling of regex filters in the Finder  Default to stderr for console helpers (only merge ifsymfony#15794 gets merged)Conflicts:src/Symfony/Component/Console/Tests/Helper/LegacyProgressHelperTest.phpsrc/Symfony/Component/EventDispatcher/EventDispatcher.phpsrc/Symfony/Component/VarDumper/Tests/CliDumperTest.phpsrc/Symfony/Component/VarDumper/Tests/HtmlDumperTest.php
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

7 participants

@alcohol@Tobion@stof@keradus@fabpot@javiereguiluz@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp