|
|
@ -28,6 +28,7 @@ import time
|
|
|
|
import locale
|
|
|
|
import locale
|
|
|
|
import logging
|
|
|
|
import logging
|
|
|
|
import getpass
|
|
|
|
import getpass
|
|
|
|
|
|
|
|
import errno
|
|
|
|
from struct import unpack, pack
|
|
|
|
from struct import unpack, pack
|
|
|
|
from termios import TIOCGWINSZ
|
|
|
|
from termios import TIOCGWINSZ
|
|
|
|
from multiprocessing import Lock
|
|
|
|
from multiprocessing import Lock
|
|
|
@ -129,11 +130,19 @@ class Display:
|
|
|
|
msg2 = to_unicode(msg2, self._output_encoding(stderr=stderr))
|
|
|
|
msg2 = to_unicode(msg2, self._output_encoding(stderr=stderr))
|
|
|
|
|
|
|
|
|
|
|
|
if not stderr:
|
|
|
|
if not stderr:
|
|
|
|
sys.stdout.write(msg2)
|
|
|
|
fileobj = sys.stdout
|
|
|
|
sys.stdout.flush()
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
sys.stderr.write(msg2)
|
|
|
|
fileobj = sys.stderr
|
|
|
|
sys.stderr.flush()
|
|
|
|
|
|
|
|
|
|
|
|
fileobj.write(msg2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
fileobj.flush()
|
|
|
|
|
|
|
|
except IOError as e:
|
|
|
|
|
|
|
|
# Ignore EPIPE in case fileobj has been prematurely closed, eg.
|
|
|
|
|
|
|
|
# when piping to "head -n1"
|
|
|
|
|
|
|
|
if e.errno != errno.EPIPE:
|
|
|
|
|
|
|
|
raise
|
|
|
|
|
|
|
|
|
|
|
|
if logger and not screen_only:
|
|
|
|
if logger and not screen_only:
|
|
|
|
msg2 = nocolor.lstrip(u'\n')
|
|
|
|
msg2 = nocolor.lstrip(u'\n')
|
|
|
|