bug #14250 [Console] Fixed SymfonyStyle when get terminal width fails (1ed)

This PR was merged into the 2.7 branch.

Discussion
----------

[Console] Fixed SymfonyStyle when get terminal width fails

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

a52b658 [Console] Fixed SymfonyStyle when get terminal width fails
This commit is contained in:
Fabien Potencier 2015-04-08 07:27:55 +02:00
commit f492b12158
1 changed files with 2 additions and 2 deletions

View File

@ -316,8 +316,8 @@ class SymfonyStyle extends OutputStyle
private function getTerminalWidth()
{
$application = new Application();
list ($width, $height) = $application->getTerminalDimensions();
$dimensions = $application->getTerminalDimensions();
return $width;
return $dimensions[0] ?: self::MAX_LINE_LENGTH;
}
}