Skip to content

Colorize output to terminal #4

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add support for env variables STDOUT_ALWAYS_ENABLE_COLOR_OUTPUT and S…
…TDOUT_DISABLE_COLOR_OUTPUT
  • Loading branch information
rubik committed Oct 8, 2014
commit 1ab7d8ed1809048d98b29b0895c1363947bf14d3
8 changes: 8 additions & 0 deletions supervisor_stdout.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import sys

COLORS = tuple(range(30, 38))
Expand All @@ -13,6 +14,13 @@ def supports_color():
Returns True if the running system's terminal supports color, and False
otherwise.
"""

if os.getenv("STDOUT_ALWAYS_ENABLE_COLOR_OUTPUT") is True:
return True

if os.getenv("STDOUT_DISABLE_COLOR_OUTPUT") is True:
return False

plat = sys.platform
supported_platform = plat != 'Pocket PC' and (plat != 'win32' or
'ANSICON' in os.environ)
Expand Down