diff options
| author | Ramiro Morales <cramm0@gmail.com> | 2013-12-02 23:11:59 -0300 |
|---|---|---|
| committer | Ramiro Morales <cramm0@gmail.com> | 2013-12-02 23:18:04 -0300 |
| commit | 12615dab78cb6fc7d8c74b7b65a4136b0feeb33f (patch) | |
| tree | 359adab8da9c791e7539f048b20bb630ca8920c7 /django | |
| parent | c75dd664cf70a159257337c3eda978de2bec9e7a (diff) | |
Fixed #13476 -- Added support for color in console output under Windows.
Detect and use the services of the ANSICON third-party tool if it's
available.
Diffstat (limited to 'django')
| -rw-r--r-- | django/core/management/color.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/django/core/management/color.py b/django/core/management/color.py index 20e31fff93..3890a4546f 100644 --- a/django/core/management/color.py +++ b/django/core/management/color.py @@ -13,10 +13,12 @@ def supports_color(): Returns True if the running system's terminal supports color, and False otherwise. """ - unsupported_platform = (sys.platform in ('win32', 'Pocket PC')) + plat = sys.platform + supported_platform = plat != 'Pocket PC' and (plat != 'win32' or + 'ANSICON' in os.environ) # isatty is not always implemented, #6223. is_a_tty = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty() - if unsupported_platform or not is_a_tty: + if not supported_platform or not is_a_tty: return False return True |
