@@ -143,11 +143,11 @@ private static function hasVt100Support(): bool
143
143
private static function initDimensionsUsingStty ()
144
144
{
145
145
if ($ sttyString = self ::getSttyColumns ()) {
146
- if (preg_match ('/rows.(\d+);.columns.(\d+);/i ' , $ sttyString , $ matches )) {
146
+ if (preg_match ('/rows.(\d+);.columns.(\d+);/is ' , $ sttyString , $ matches )) {
147
147
// extract [w, h] from "rows h; columns w;"
148
148
self ::$ width = (int ) $ matches [2 ];
149
149
self ::$ height = (int ) $ matches [1 ];
150
- } elseif (preg_match ('/;.(\d+).rows;.(\d+).columns/i ' , $ sttyString , $ matches )) {
150
+ } elseif (preg_match ('/;.(\d+).rows;.(\d+).columns/is ' , $ sttyString , $ matches )) {
151
151
// extract [w, h] from "; h rows; w columns"
152
152
self ::$ width = (int ) $ matches [2 ];
153
153
self ::$ height = (int ) $ matches [1 ];
@@ -176,10 +176,10 @@ private static function getConsoleMode(): ?array
176
176
*/
177
177
private static function getSttyColumns (): ?string
178
178
{
179
- return self ::readFromProcess ('stty -a | grep columns ' );
179
+ return self ::readFromProcess ([ 'stty ' , ' -a ' ] );
180
180
}
181
181
182
- private static function readFromProcess (string $ command ): ?string
182
+ private static function readFromProcess (string | array $ command ): ?string
183
183
{
184
184
if (!\function_exists ('proc_open ' )) {
185
185
return null ;
0 commit comments