Skip to content

Commit 749efca

Browse files
committed
Only call colorama.init() on Windows
On non-Windows platforms, using the colors_enabled() function works because isatty() also works reliably.
1 parent 154544d commit 749efca

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

cli_ui/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@
3838
_ENABLE_XTERM_TITLE = None
3939

4040

41-
colorama.init()
41+
if os.name == "nt":
42+
# On Windows using `isatty()` does *not* work reliably,
43+
# so we always setup colorama.
44+
# See colors_enabled() for details
45+
colorama.init()
4246

4347

4448
# Tokens can be strings, or Color, UnicodeSequence or Symbol instances,

docs/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ v0.14.1
55
+++++++
66

77
* Development branch is now called ``main``.
8+
* Fix #66 - only call ``colorama.init()`` on Windows.
89

910
v0.14.0 (2021-04-20)
1011
++++++++++++++++++++

0 commit comments

Comments
 (0)