mirror of
https://github.com/httpie/cli.git
synced 2025-01-22 03:08:59 +02:00
Colorize stderr on Windows.
This commit is contained in:
parent
1681a4ddd0
commit
fc4f70a900
@ -28,16 +28,17 @@ class Environment(object):
|
|||||||
stdin_isatty = sys.stdin.isatty()
|
stdin_isatty = sys.stdin.isatty()
|
||||||
|
|
||||||
stdout_isatty = sys.stdout.isatty()
|
stdout_isatty = sys.stdout.isatty()
|
||||||
if stdout_isatty and is_windows:
|
stderr_isatty = sys.stderr.isatty()
|
||||||
|
if is_windows:
|
||||||
# noinspection PyUnresolvedReferences
|
# noinspection PyUnresolvedReferences
|
||||||
from colorama.initialise import wrap_stream
|
from colorama.initialise import wrap_stream
|
||||||
stdout = wrap_stream(sys.stdout, convert=None,
|
stdout = wrap_stream(sys.stdout, convert=None,
|
||||||
strip=None, autoreset=True, wrap=True)
|
strip=None, autoreset=True, wrap=True)
|
||||||
|
stderr = wrap_stream(sys.stderr, convert=None,
|
||||||
|
strip=None, autoreset=True, wrap=True)
|
||||||
else:
|
else:
|
||||||
stdout = sys.stdout
|
stdout = sys.stdout
|
||||||
|
|
||||||
stderr = sys.stderr
|
stderr = sys.stderr
|
||||||
stderr_isatty = sys.stderr.isatty()
|
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
assert all(hasattr(type(self), attr)
|
assert all(hasattr(type(self), attr)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user