bug #27831 Check for Hyper terminal on all operating systems. (azjezz)

This PR was squashed before being merged into the 2.8 branch (closes #27831).

Discussion
----------

 Check for Hyper terminal on all operating systems.

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

return true if the terminal is Hyper.is on all operating systems not limited to windows.

Commits
-------

196e708b68  Check for Hyper terminal on all operating systems.
This commit is contained in:
Nicolas Grekas 2018-07-04 17:34:59 +02:00
commit db5dd7bdd3
4 changed files with 16 additions and 7 deletions

View File

@ -226,13 +226,16 @@ class DeprecationErrorHandler
return false;
}
if ('Hyper' === getenv('TERM_PROGRAM')) {
return true;
}
if (DIRECTORY_SEPARATOR === '\\') {
return (function_exists('sapi_windows_vt100_support')
&& sapi_windows_vt100_support(STDOUT))
|| false !== getenv('ANSICON')
|| 'ON' === getenv('ConEmuANSI')
|| 'xterm' === getenv('TERM')
|| 'Hyper' === getenv('TERM_PROGRAM');
|| 'xterm' === getenv('TERM');
}
if (function_exists('stream_isatty')) {

View File

@ -93,13 +93,16 @@ class StreamOutput extends Output
*/
protected function hasColorSupport()
{
if ('Hyper' === getenv('TERM_PROGRAM')) {
return true;
}
if (DIRECTORY_SEPARATOR === '\\') {
return (function_exists('sapi_windows_vt100_support')
&& @sapi_windows_vt100_support($this->stream))
|| false !== getenv('ANSICON')
|| 'ON' === getenv('ConEmuANSI')
|| 'xterm' === getenv('TERM')
|| 'Hyper' === getenv('TERM_PROGRAM');
|| 'xterm' === getenv('TERM');
}
if (function_exists('stream_isatty')) {

View File

@ -271,7 +271,7 @@ class SymfonyStyle extends OutputStyle
{
$progressBar = parent::createProgressBar($max);
if ('\\' !== DIRECTORY_SEPARATOR || 'Hyper' === getenv('TERM_PROGRAM')) {
if ('\\' !== DIRECTORY_SEPARATOR || 'Hyper' === getenv('TERM_PROGRAM')) {
$progressBar->setEmptyBarCharacter('░'); // light shade character \u2591
$progressBar->setProgressCharacter('');
$progressBar->setBarCharacter('▓'); // dark shade character \u2593

View File

@ -479,13 +479,16 @@ class CliDumper extends AbstractDumper
return false;
}
if ('Hyper' === getenv('TERM_PROGRAM')) {
return true;
}
if (DIRECTORY_SEPARATOR === '\\') {
return (function_exists('sapi_windows_vt100_support')
&& @sapi_windows_vt100_support($stream))
|| false !== getenv('ANSICON')
|| 'ON' === getenv('ConEmuANSI')
|| 'xterm' === getenv('TERM')
|| 'Hyper' === getenv('TERM_PROGRAM');
|| 'xterm' === getenv('TERM');
}
if (function_exists('stream_isatty')) {