diff options
author | Karel Kočí <cynerd@email.cz> | 2015-09-21 19:49:51 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2015-09-21 19:49:51 +0200 |
commit | 769a43b767212ce6e0cb6cebf396130c2b54dee0 (patch) | |
tree | e1a3fc4bdcb3d3f8d767cc33b509559b44670650 /scripts | |
parent | 5ef685ddb6aafe82ab7baa589c055721d3e51cac (diff) | |
download | linux-conf-perf-769a43b767212ce6e0cb6cebf396130c2b54dee0.tar.gz linux-conf-perf-769a43b767212ce6e0cb6cebf396130c2b54dee0.tar.bz2 linux-conf-perf-769a43b767212ce6e0cb6cebf396130c2b54dee0.zip |
Ignore decode error from subprocess
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/utils.py | 16 |
1 files 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() |