From 769a43b767212ce6e0cb6cebf396130c2b54dee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Mon, 21 Sep 2015 19:49:51 +0200 Subject: Ignore decode error from subprocess --- scripts/utils.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/utils.py b/scripts/utils.py index f6a4720..ac7f6a3 100644 --- a/scripts/utils.py +++ b/scripts/utils.py @@ -79,12 +79,16 @@ def callsubprocess(process_name, process, show_output = True, f.write('::' + time.strftime("%y-%m-%d-%H-%M-%S-%f") + '::\n') for linen in sprc.stdout: timerout.output() - line = linen.decode(sys.getdefaultencoding()) - f.write(line) - if show_output: - print(line, end="") - if return_output: - rtn.append(line.rstrip()) + try: + line = linen.decode(sys.getdefaultencoding()) + f.write(line) + if show_output: + print(line, end="") + if return_output: + rtn.append(line.rstrip()) + except UnicodeDecodeError: + if return_output: + rtn.append('DecodeError') if timerout.exit(): raise exceptions.ProcessTimeout(process_name, rtn) rtncode = sprc.wait() -- cgit v1.2.3