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] progress bar fix#19012

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
fabpot merged 5 commits intosymfony:masterfromfabpot:console-progress-bar-fix
Jun 17, 2016

Conversation

@fabpot
Copy link
Member

@fabpotfabpot commentedJun 9, 2016
edited
Loading

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

This is#16490 where I've simplified the code as much as possible and added a test for the bug we're trying to fix.

The main change is the renaming of theTerminalDimensionsProvider to justTerminal. The new class can probably be useful to add more about the terminal.

@stof
Copy link
Member

stof commentedJun 9, 2016

There is still 1 drawback here: as the ProgressBar uses its own Terminal instance, it will ignore any explicit overwrite done in the Application.

@stof
Copy link
Member

stof commentedJun 9, 2016

do you want to merge this in 3.2 only or in older branches as a bugfix ?

@fabpot
Copy link
MemberAuthor

I'm aware of the drawback. I don't see how to fix this and TBH, I don't think it matters too much as playing with the dimensions should only be done when testing an app.

Only for 3.2.

@fabpot
Copy link
MemberAuthor

Added some deprecations now.

protectedfunctiongetTerminalWidth()
{
$dimensions =$this->getTerminalDimensions();

Copy link
Member

Choose a reason for hiding this comment

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

please add the deprecation warnings too

@javiereguiluz
Copy link
Member

The newSymfony\Component\Console\Terminal class is missing in the PR.

@fabpotfabpotforce-pushed theconsole-progress-bar-fix branch 5 times, most recently froma095d0b to8d71affCompareJune 9, 2016 15:41
@fabpot
Copy link
MemberAuthor

added the deprecations and simplified the code again by removinggetDimensions().

@fabpotfabpotforce-pushed theconsole-progress-bar-fix branch 3 times, most recently from9773191 to5afbdbbCompareJune 9, 2016 16:03
/**
* Sets the terminal height.
*
* @param int
Copy link
Member

Choose a reason for hiding this comment

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

missing param name, makign the phpdoc invalid

@fabpotfabpotforce-pushed theconsole-progress-bar-fix branch 2 times, most recently from60a2d62 toa38bb97CompareJune 9, 2016 16:26
@nicolas-grekas
Copy link
Member

It could be useful to configure width+height with an env var, especially in tests.
This would allow testing commands that hardcodenew SymfonyStyle and would replace thestty cols 120 in the .travis.yml file (and could replace thegetTerminal extension points and replace related mocks).

@fabpot
Copy link
MemberAuthor

@nicolas-grekas Done. I've kept the config in .travis.yml

@nicolas-grekas
Copy link
Member

LGTM, except a test failure

$this->terminalDimensions =array($width,$height);
@trigger_error(sprintf('%s is deprecated as of 3.2 and will be removed in 4.0. Set the ANSICON env var instead.',__METHOD__, ArgumentResolverInterface::class),E_USER_DEPRECATED);

putenv('ANSICON='.$width.'x'.$height);
Copy link
Member

Choose a reason for hiding this comment

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

this is a bad idea, as it will also impact the detection of color support on Windows

Copy link
Member

Choose a reason for hiding this comment

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

We should support a different env var following the same format if we want to go this way (but keeping support for the ANSICON one for auto-detection)

Copy link
Member

Choose a reason for hiding this comment

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

btw, this code is broken, as it does not invalidate the Terminal cache

Choose a reason for hiding this comment

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

What about using COLUMNS and LINES? These are what bash uses (they are magic variables that can be overriden, tryecho $COLUMNS).

@fabpotfabpotforce-pushed theconsole-progress-bar-fix branch from6e105a8 to2eeb7bdCompareJune 13, 2016 19:50
@fabpotfabpotforce-pushed theconsole-progress-bar-fix branch 2 times, most recently from534d825 toc92b2b4CompareJune 16, 2016 13:11
@fabpot
Copy link
MemberAuthor

Broken test on HHVM not related.

@nicolas-grekas
Copy link
Member

👍 with this patch:

--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php@@ -28,6 +28,8 @@ class UserPasswordEncoderCommandTest extends WebTestCase    public function testEncodePasswordEmptySalt()    {+        putenv('COLUMNS=120');+        $this->passwordEncoderCommandTester->execute(array(            'command' => 'security:encode-password',

@stof
Copy link
Member

@fabpot are you sure ? the failing test is related to line wrapping in commands.

I think one of your Console test does not properly reset the env variables on teardown, and so it impacts subsequent tests. Non-hhvm builds are unaffected because they use a separate PHP process per component to run things in parallel

@trigger_error(sprintf('%s is deprecated as of 3.2 and will be removed in 4.0. Set the COLUMNS and LINES env vars instead.',__METHOD__, ArgumentResolverInterface::class),E_USER_DEPRECATED);

putenv('COLUMNS='.$width);
putenv('LINES='.$height);
Copy link
Member

Choose a reason for hiding this comment

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

this does not work in case the dimensions were already retrieved previously, because of the Terminal internal cache

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

fixed

@fabpotfabpotforce-pushed theconsole-progress-bar-fix branch 4 times, most recently from660b6e8 tob233974CompareJune 16, 2016 15:54
@fabpot
Copy link
MemberAuthor

should be good now :)

@fabpotfabpotforce-pushed theconsole-progress-bar-fix branch fromb233974 to355ad6cCompareJune 16, 2016 16:11
}
}

if (0 === self::$width) {

Choose a reason for hiding this comment

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

not sure this check works: when is this zero?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

that's old code, removed.

@fabpotfabpotforce-pushed theconsole-progress-bar-fix branch from355ad6c todba73e7CompareJune 17, 2016 07:00
@fabpotfabpotforce-pushed theconsole-progress-bar-fix branch fromdba73e7 to2f81247CompareJune 17, 2016 17:36
@fabpot
Copy link
MemberAuthor

Thank you@TomasVotruba.

@fabpotfabpot merged commit2f81247 intosymfony:masterJun 17, 2016
fabpot added a commit that referenced this pull requestJun 17, 2016
This PR was merged into the 3.2-dev branch.Discussion----------[Console] progress bar fix| Q             | A| ------------- | ---| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#13019| License       | MIT| Doc PR        | -This is#16490 where I've simplified the code as much as possible and added a test for the bug we're trying to fix.The main change is the renaming of the `TerminalDimensionsProvider` to just `Terminal`. The new class can probably be useful to add more about the terminal.Commits-------2f81247 switched to use COLUMNS and LINES env vars to change terminal dimensionsbf7a5c5 fixed logica589635 deprecated some Console Application methods8f206c8 fixed CS, simplified codeb030c24 [Console] ProgressBar - adjust to the window width (static)
@TomasVotruba
Copy link
Contributor

Thank you@fabpot for finishing!

@fabpotfabpot mentioned this pull requestOct 27, 2016
nicolas-grekas added a commit that referenced this pull requestMay 21, 2017
This PR was merged into the 4.0-dev branch.Discussion----------[Console] Remove deprecated features| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| BC breaks?    | yes| Deprecations? | no| Tests pass?   | yes| Fixed tickets | ~~#18999#19012~~| License       | MIT| Doc PR        | n/aCommits-------4cde3b9 [Console] Remove deprecated features
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.

6 participants

@fabpot@stof@javiereguiluz@nicolas-grekas@TomasVotruba@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp