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] Get dimensions from stty on windows if possible#32763

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 1 commit intosymfony:3.4fromrtek:add-windows-stty
Sep 13, 2019
Merged

[Console] Get dimensions from stty on windows if possible#32763

fabpot merged 1 commit intosymfony:3.4fromrtek:add-windows-stty
Sep 13, 2019

Conversation

@rtek
Copy link
Contributor

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

Console\Terminal is modified to extract width/height settings to fromstty on windows if possible. Previously such values were extracted frommode CON. If another terminal is in use (eg, gitbash) then the incorrect values would be applied.

@rtek
Copy link
ContributorAuthor

Had to refactor Terminal into a singleton otherwise it couldn't be tested when mocking out the env. It was practically one already due to the static properties.

@nicolas-grekasnicolas-grekas added this to the4.3 milestoneJul 26, 2019
@fabpot
Copy link
Member

@rtek Tests must not impact our code. I would highly suggest to remove the singleton and find a way to test the code in another way.

chalasr reacted with thumbs up emoji

@rtek
Copy link
ContributorAuthor

@fabpot Understood - reverted the public API changes.

Remaster,Terminal appears to be short-circuited via envvars after application initializationApplication.php:117Terminal.php:26 so it's basically global state. It's used by various classes which contain their own terminal capability check as well, so it's a candidate for consolidation. I offer to put some effort into this if there is an appetite.

privatestatic$width;
privatestatic$height;
private$width;
private$height;
Copy link
Member

Choose a reason for hiding this comment

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

I think they were static as a way to cache the values.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Agreed, but only in a non application context. Application sets envCOLUMNS/LINES from the calculated values inTerminal, which then provides caching sinceTerminal always checks the env first. Only those who instantiateTerminal outside of an application and did not reuse the instance would lose the cache. If this is not acceptable then I would have to use reflection to get the test coverage - is that OK?

Copy link
Member

Choose a reason for hiding this comment

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

Looking at the code base, I can see that we are instantiating a Terminal instance several times (the instance is not shared).

@rtek
Copy link
ContributorAuthor

Reverted to maintain the static cache convention and used reflection to test. Test failures on unrelated component.

@chalasrchalasr changed the base branch from4.3 to3.4September 13, 2019 12:37
@chalasrchalasr modified the milestones:4.3,3.4Sep 13, 2019
@chalasr
Copy link
Member

PR target changed from 4.3 to 3.4 as the bug also exists there.
Also updatedQuestionHelper to make it uses the internalTerminal::hasSttyAvailable() so that we don't have duplication.

@fabpot
Copy link
Member

Thank you@rtek.

fabpot added a commit that referenced this pull requestSep 13, 2019
…(rtek)This PR was merged into the 3.4 branch.Discussion----------[Console] Get dimensions from stty on windows if possible| Q             | A| ------------- | ---| Branch?       | 4.3| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets || License       | MIT| Doc PR        |`Console\Terminal` is modified to extract width/height settings to from `stty` on windows if possible. Previously such values were extracted from `mode CON`. If another terminal is in use (eg, gitbash) then the incorrect values would be applied.Commits-------5265080 [Console] Get dimensions from stty on windows if possible
@fabpotfabpot merged commit5265080 intosymfony:3.4Sep 13, 2019
This was referencedOct 7, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof left review comments

@fabpotfabpotfabpot approved these changes

@chalasrchalasrchalasr approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

3.4

Development

Successfully merging this pull request may close these issues.

6 participants

@rtek@fabpot@chalasr@stof@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp