summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorSulabh Katila <sulabhkatila@gmail.com>2023-08-30 23:03:30 -0400
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-09-01 11:26:29 +0200
commit9a9620dda649dcdb685662bbd9cb409bfeff4214 (patch)
tree73ec7f581a52809ccb0ee68bc451f3093e65e884 /django
parent9cc0d7f7f85cecc3ad15bbc471fe6a08e4f515b6 (diff)
Fixed #34768 -- Avoided initializing colorama on non-Windows platforms.
Diffstat (limited to 'django')
-rw-r--r--django/core/management/color.py5
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.