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

Fixed colorama initialization (#36).

This commit is contained in:
Jakub Roztocil
2012-07-21 15:08:28 +02:00
parent 19f760450f
commit 0a673613ef
3 changed files with 18 additions and 14 deletions

View File

@@ -1,13 +1,22 @@
import os
import sys
from requests.compat import urlparse
from requests.compat import urlparse, is_windows
class Environment(object):
stdin_isatty = sys.stdin.isatty()
stdin = sys.stdin
if is_windows:
# `colorama` patches `sys.stdout` so its initialization
# needs to happen before the default environment is set.
import colorama
colorama.init()
del colorama
stdout_isatty = sys.stdout.isatty()
stdout = sys.stdout
# Can be set to 0 to disable colors completely.
colors = 256 if '256color' in os.environ.get('TERM', '') else 88