зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 12536416d070 (bug 991866) for breaking B2G mochitests.
CLOSED TREE
This commit is contained in:
Родитель
3250d2da42
Коммит
d6d20ed14c
|
@ -908,24 +908,14 @@ class StoreOutput(object):
|
|||
|
||||
class StreamOutput(object):
|
||||
"""pass output to a stream and flush"""
|
||||
encodings = ['utf-8', 'iso8859-1']
|
||||
|
||||
def __init__(self, stream):
|
||||
self.stream = stream
|
||||
|
||||
def __call__(self, line):
|
||||
self.stream.write(self.decode(line) + '\n')
|
||||
self.stream.write(line + '\n')
|
||||
self.stream.flush()
|
||||
|
||||
def decode(self, line):
|
||||
exc_info = None
|
||||
for encoding in self.encodings:
|
||||
try:
|
||||
return line.decode(encoding, 'replace')
|
||||
except UnicodeDecodeError:
|
||||
exc_info = sys.exc_info()
|
||||
raise exc_info[0], exc_info[1], exc_info[2]
|
||||
|
||||
class LogOutput(StreamOutput):
|
||||
"""pass output to a file"""
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче