diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2015-10-19 21:50:03 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2015-10-19 21:50:03 +0300 |
commit | 47cb6c10306d89172ce6aafa09a450e85f4a8f8d (patch) | |
tree | ecfbb95d4351e817349dc6e7786b4d068b30feec | |
parent | 5504c3ac950e3f34abf74550479111f763825ded (diff) | |
download | meson-47cb6c10306d89172ce6aafa09a450e85f4a8f8d.zip meson-47cb6c10306d89172ce6aafa09a450e85f4a8f8d.tar.gz meson-47cb6c10306d89172ce6aafa09a450e85f4a8f8d.tar.bz2 |
More robust output decoding. Closes #289.
-rwxr-xr-x | meson_test.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/meson_test.py b/meson_test.py index 9353b18..8061215 100755 --- a/meson_test.py +++ b/meson_test.py @@ -38,6 +38,12 @@ class TestRun(): self.stde = stde self.cmd = cmd +def decode(stream): + try: + return stream.decode('utf-8') + except UnicodeDecodeError: + return stream.decode('iso-8859-1', errors='ignore') + def write_log(logfile, test_name, result_str, result): logfile.write(result_str + '\n\n') logfile.write('--- command ---\n') @@ -108,8 +114,8 @@ def run_single_test(wrap, test): (stdo, stde) = p.communicate() endtime = time.time() duration = endtime - starttime - stdo = stdo.decode() - stde = stde.decode() + stdo = decode(stdo) + stde = decode(stde) if timed_out: res = 'TIMEOUT' tests_failed = True |