|
|
@ -286,7 +286,7 @@ class Console |
|
|
|
* You can pass any of the FG_*, BG_* and TEXT_* constants and also [[xtermFgColor]] and [[xtermBgColor]]. |
|
|
|
* You can pass any of the FG_*, BG_* and TEXT_* constants and also [[xtermFgColor]] and [[xtermBgColor]]. |
|
|
|
* @return string |
|
|
|
* @return string |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static function ansiFormat($string, $format=array()) |
|
|
|
public static function ansiFormat($string, $format = array()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$code = implode(';', $format); |
|
|
|
$code = implode(';', $format); |
|
|
|
return "\033[0m" . ($code !== '' ? "\033[" . $code . "m" : '') . $string . "\033[0m"; |
|
|
|
return "\033[0m" . ($code !== '' ? "\033[" . $code . "m" : '') . $string . "\033[0m"; |
|
|
@ -589,11 +589,10 @@ class Console |
|
|
|
if (static::isRunningOnWindows()) { |
|
|
|
if (static::isRunningOnWindows()) { |
|
|
|
$output = array(); |
|
|
|
$output = array(); |
|
|
|
exec('mode con', $output); |
|
|
|
exec('mode con', $output); |
|
|
|
if(isset($output) && strpos($output[1], 'CON')!==false) { |
|
|
|
if (isset($output) && strpos($output[1], 'CON') !== false) { |
|
|
|
return $size = array((int)preg_replace('~[^0-9]~', '', $output[3]), (int)preg_replace('~[^0-9]~', '', $output[4])); |
|
|
|
return $size = array((int)preg_replace('~[^0-9]~', '', $output[3]), (int)preg_replace('~[^0-9]~', '', $output[4])); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
|
|
// try stty if available |
|
|
|
// try stty if available |
|
|
|
$stty = array(); |
|
|
|
$stty = array(); |
|
|
|
if (exec('stty -a 2>&1', $stty) && preg_match('/rows\s+(\d+);\s*columns\s+(\d+);/mi', implode(' ', $stty), $matches)) { |
|
|
|
if (exec('stty -a 2>&1', $stty) && preg_match('/rows\s+(\d+);\s*columns\s+(\d+);/mi', implode(' ', $stty), $matches)) { |
|
|
|