File tree 1 file changed +14
-1
lines changed
src/Symfony/Component/Console
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,9 @@ private static function initDimensions()
79
79
// or [w, h] from "wxh"
80
80
self ::$ width = (int ) $ matches [1 ];
81
81
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
83
85
self ::initDimensionsUsingStty ();
84
86
} elseif (null !== $ dimensions = self ::getConsoleMode ()) {
85
87
// extract [w, h] from "wxh"
@@ -91,6 +93,17 @@ private static function initDimensions()
91
93
}
92
94
}
93
95
96
+ /**
97
+ * Returns whether STDOUT has vt100 support (some Windows 10+ configurations).
98
+ */
99
+ private static function hasVt100Support ()
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
+ */
94
107
private static function initDimensionsUsingStty ()
95
108
{
96
109
if ($ sttyString = self ::getSttyColumns ()) {
You can’t perform that action at this time.
0 commit comments