|
|
|
@ -619,8 +619,18 @@ class BaseConsole
|
|
|
|
|
} else { |
|
|
|
|
// try stty if available |
|
|
|
|
$stty = []; |
|
|
|
|
if (exec('stty -a 2>&1', $stty) && preg_match('/rows\s+(\d+);\s*columns\s+(\d+);/mi', implode(' ', $stty), $matches)) { |
|
|
|
|
return $size = [(int)$matches[2], (int)$matches[1]]; |
|
|
|
|
if (exec('stty -a 2>&1', $stty)) { |
|
|
|
|
$stty = implode(' ', $stty); |
|
|
|
|
|
|
|
|
|
// Linux stty output |
|
|
|
|
if (preg_match('/rows\s+(\d+);\s*columns\s+(\d+);/mi', $stty, $matches)) { |
|
|
|
|
return $size = [(int)$matches[2], (int)$matches[1]]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// MacOS stty output |
|
|
|
|
if (preg_match('/(\d+)\s+rows;\s*(\d+)\s+columns;/mi', $stty, $matches)) { |
|
|
|
|
return $size = [(int)$matches[2], (int)$matches[1]]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// fallback to tput, which may not be updated on terminal resize |
|
|
|
|