Patch for Windows banner display

This commit is contained in:
Miroslav Stampar
2016-04-29 00:51:20 +02:00
parent 9dd5cd8eb6
commit ad612bf9e4
4 changed files with 17 additions and 10 deletions

View File

@@ -21,13 +21,15 @@ def reset_all():
def init(autoreset=False, convert=None, strip=None, wrap=True):
global wrapped_stdout, wrapped_stderr
global orig_stdout, orig_stderr
if orig_stdout is not None:
return
if not wrap and any([autoreset, convert, strip]):
raise ValueError('wrap=False conflicts with any other arg=True')
global wrapped_stdout, wrapped_stderr
global orig_stdout, orig_stderr
orig_stdout = sys.stdout
orig_stderr = sys.stderr
@@ -49,10 +51,15 @@ def init(autoreset=False, convert=None, strip=None, wrap=True):
def deinit():
global orig_stdout
global orig_stderr
if orig_stdout is not None:
sys.stdout = orig_stdout
orig_stdout = None
if orig_stderr is not None:
sys.stderr = orig_stderr
orig_stderr = None
@contextlib.contextmanager