diff options
| author | Sulabh Katila <sulabhkatila@gmail.com> | 2023-08-30 23:03:30 -0400 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-09-01 11:26:29 +0200 |
| commit | 9a9620dda649dcdb685662bbd9cb409bfeff4214 (patch) | |
| tree | 73ec7f581a52809ccb0ee68bc451f3093e65e884 /django | |
| parent | 9cc0d7f7f85cecc3ad15bbc471fe6a08e4f515b6 (diff) | |
Fixed #34768 -- Avoided initializing colorama on non-Windows platforms.
Diffstat (limited to 'django')
| -rw-r--r-- | django/core/management/color.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/django/core/management/color.py b/django/core/management/color.py index 229e9b4e4a..3bcefcd990 100644 --- a/django/core/management/color.py +++ b/django/core/management/color.py @@ -11,7 +11,8 @@ from django.utils import termcolors try: import colorama - colorama.init() + # Avoid initializing colorama in non-Windows platforms. + colorama.just_fix_windows_console() except (ImportError, OSError): HAS_COLORAMA = False else: @@ -48,7 +49,7 @@ def supports_color(): return is_a_tty and ( sys.platform != "win32" - or HAS_COLORAMA + or (HAS_COLORAMA and getattr(colorama, "fixed_windows_console", False)) or "ANSICON" in os.environ or # Windows Terminal supports VT codes. |
