private function Application::getConsoleMode in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/console/Application.php \Symfony\Component\Console\Application::getConsoleMode()
Runs and parses mode CON if it's available, suppressing any error output.
Return value
string <width>x<height> or null if it could not be parsed
1 call to Application::getConsoleMode()
- Application::getTerminalDimensions in vendor/
symfony/ console/ Application.php - Tries to figure out the terminal dimensions based on the current environment.
File
- vendor/
symfony/ console/ Application.php, line 956
Class
- Application
- An Application is the container for a collection of commands.
Namespace
Symfony\Component\ConsoleCode
private function getConsoleMode() {
if (!function_exists('proc_open')) {
return;
}
$descriptorspec = array(
1 => array(
'pipe',
'w',
),
2 => array(
'pipe',
'w',
),
);
$process = proc_open('mode CON', $descriptorspec, $pipes, null, null, array(
'suppress_errors' => true,
));
if (is_resource($process)) {
$info = stream_get_contents($pipes[1]);
fclose($pipes[1]);
fclose($pipes[2]);
proc_close($process);
if (preg_match('/--------+\\r?\\n.+?(\\d+)\\r?\\n.+?(\\d+)\\r?\\n/', $info, $matches)) {
return $matches[2] . 'x' . $matches[1];
}
}
}