Skip to content

[Console] Add support for NO_COLOR env var #34252

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add support for NO_COLOR env var
  • Loading branch information
Seldaek committed Nov 8, 2019
commit c1b0a8e956e86bf86913c481b7a169ebd04a77b1
5 changes: 5 additions & 0 deletions src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,11 @@ private static function hasColorSupport()
return false;
}

// Follow https://no-color.org/
if (isset($_SERVER['NO_COLOR']) || false !== getenv('NO_COLOR')) {
return false;
}

if ('Hyper' === getenv('TERM_PROGRAM')) {
return true;
}
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/Console/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ CHANGELOG
* deprecated returning `null` from `Command::execute()`, return `0` instead
* Deprecated the `Application::renderException()` and `Application::doRenderException()` methods,
use `renderThrowable()` and `doRenderThrowable()` instead.
* added support for the `NO_COLOR` env var (https://no-color.org/)

4.3.0
-----
Expand Down
5 changes: 5 additions & 0 deletions src/Symfony/Component/Console/Output/StreamOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ protected function doWrite($message, $newline)
*/
protected function hasColorSupport()
{
// Follow https://no-color.org/
if (isset($_SERVER['NO_COLOR']) || false !== getenv('NO_COLOR')) {
return false;
}

if ('Hyper' === getenv('TERM_PROGRAM')) {
return true;
}
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/VarDumper/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ CHANGELOG
* added the stamps of a message after it is dispatched in `TraceableMessageBus` and `MessengerDataCollector` collected data
* added `UuidCaster`
* made all casters final
* added support for the `NO_COLOR` env var (https://no-color.org/)

4.3.0
-----
Expand Down
5 changes: 5 additions & 0 deletions src/Symfony/Component/VarDumper/Dumper/CliDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,11 @@ private function hasColorSupport($stream): bool
return false;
}

// Follow https://no-color.org/
if (isset($_SERVER['NO_COLOR']) || false !== getenv('NO_COLOR')) {
return false;
}

if ('Hyper' === getenv('TERM_PROGRAM')) {
return true;
}
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy