You are here

private function Application::getSttyColumns in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/console/Application.php \Symfony\Component\Console\Application::getSttyColumns()

Runs and parses stty -a if it's available, suppressing any error output.

Return value

string

1 call to Application::getSttyColumns()
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 933

Class

Application
An Application is the container for a collection of commands.

Namespace

Symfony\Component\Console

Code

private function getSttyColumns() {
  if (!function_exists('proc_open')) {
    return;
  }
  $descriptorspec = array(
    1 => array(
      'pipe',
      'w',
    ),
    2 => array(
      'pipe',
      'w',
    ),
  );
  $process = proc_open('stty -a | grep columns', $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);
    return $info;
  }
}