1
0
mirror of https://github.com/httpie/cli.git synced 2025-08-10 22:42:05 +02:00

Fixed colorized output on Windows with Python 3.

Closes #87.
This commit is contained in:
Jakub Roztocil
2012-08-17 06:35:18 +02:00
parent 86256af1df
commit 4660da949f
5 changed files with 56 additions and 20 deletions

View File

@@ -18,14 +18,16 @@ class Environment(object):
if progname not in ['http', 'https']:
progname = 'http'
if is_windows:
import colorama.initialise
colorama.initialise.init()
stdin_isatty = sys.stdin.isatty()
stdin = sys.stdin
stdout_isatty = sys.stdout.isatty()
stdout = sys.stdout
if stdout_isatty and is_windows:
from colorama.initialise import wrap_stream
stdout = wrap_stream(sys.stdout, convert=None,
strip=None, autoreset=True, wrap=True)
else:
stdout = sys.stdout
stderr = sys.stderr
# Can be set to 0 to disable colors completely.