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

Commit32bde39

Browse files
bug#34344 [Console] Constant STDOUT might be undefined (nicolas-grekas)
This PR was merged into the 3.4 branch.Discussion----------[Console] Constant STDOUT might be undefined| Q | A| ------------- | ---| Branch? | 3.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets |Fix#34341| License | MIT| Doc PR | N/ACommits-------bb8c82c [Console] Constant STDOUT might be undefined.
2 parents53dc781 +bb8c82c commit32bde39

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

‎src/Symfony/Component/Console/Terminal.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ private static function initDimensions()
7979
// or [w, h] from "wxh"
8080
self::$width = (int)$matches[1];
8181
self::$height =isset($matches[4]) ? (int)$matches[4] : (int)$matches[2];
82-
}elseif (self::hasSttyAvailable()) {
82+
}elseif (!self::hasVt100Support() &&self::hasSttyAvailable()) {
83+
// only use stty on Windows if the terminal does not support vt100 (e.g. Windows 7 + git-bash)
84+
// testing for stty in a Windows 10 vt100-enabled console will implicitly disable vt100 support on STDOUT
8385
self::initDimensionsUsingStty();
8486
}elseif (null !==$dimensions =self::getConsoleMode()) {
8587
// extract [w, h] from "wxh"
@@ -91,6 +93,17 @@ private static function initDimensions()
9193
}
9294
}
9395

96+
/**
97+
* Returns whether STDOUT has vt100 support (some Windows 10+ configurations).
98+
*/
99+
privatestaticfunctionhasVt100Support()
100+
{
101+
return\function_exists('sapi_windows_vt100_support') &&sapi_windows_vt100_support(fopen('php://stdout','w'));
102+
}
103+
104+
/**
105+
* Initializes dimensions using the output of an stty columns line.
106+
*/
94107
privatestaticfunctioninitDimensionsUsingStty()
95108
{
96109
if ($sttyString =self::getSttyColumns()) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp