Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/console/Output/StreamOutput.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | c2387f117808 |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
31 class StreamOutput extends Output | 31 class StreamOutput extends Output |
32 { | 32 { |
33 private $stream; | 33 private $stream; |
34 | 34 |
35 /** | 35 /** |
36 * Constructor. | |
37 * | |
38 * @param resource $stream A stream resource | 36 * @param resource $stream A stream resource |
39 * @param int $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface) | 37 * @param int $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface) |
40 * @param bool|null $decorated Whether to decorate messages (null for auto-guessing) | 38 * @param bool|null $decorated Whether to decorate messages (null for auto-guessing) |
41 * @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter) | 39 * @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter) |
42 * | 40 * |
83 /** | 81 /** |
84 * Returns true if the stream supports colorization. | 82 * Returns true if the stream supports colorization. |
85 * | 83 * |
86 * Colorization is disabled if not supported by the stream: | 84 * Colorization is disabled if not supported by the stream: |
87 * | 85 * |
88 * - Windows != 10.0.10586 without Ansicon, ConEmu or Mintty | 86 * - the stream is redirected (eg php file.php >log) |
87 * - Windows without VT100 support, Ansicon, ConEmu, Mintty | |
89 * - non tty consoles | 88 * - non tty consoles |
90 * | 89 * |
91 * @return bool true if the stream supports colorization, false otherwise | 90 * @return bool true if the stream supports colorization, false otherwise |
92 */ | 91 */ |
93 protected function hasColorSupport() | 92 protected function hasColorSupport() |
94 { | 93 { |
94 if (function_exists('stream_isatty') && !@stream_isatty($this->stream)) { | |
95 return false; | |
96 } | |
95 if (DIRECTORY_SEPARATOR === '\\') { | 97 if (DIRECTORY_SEPARATOR === '\\') { |
98 if (function_exists('sapi_windows_vt100_support')) { | |
99 $vt100Enabled = @sapi_windows_vt100_support($this->stream); | |
100 } else { | |
101 $vt100Enabled = '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD; | |
102 } | |
103 | |
96 return | 104 return |
97 '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD | 105 $vt100Enabled |
98 || false !== getenv('ANSICON') | 106 || false !== getenv('ANSICON') |
99 || 'ON' === getenv('ConEmuANSI') | 107 || 'ON' === getenv('ConEmuANSI') |
100 || 'xterm' === getenv('TERM'); | 108 || 'xterm' === getenv('TERM'); |
101 } | 109 } |
102 | 110 |