diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-12-07 07:03:15 +0530 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2016-12-11 01:59:58 +0200 |
commit | 60716fcd6debd9f1ebca0091c945df16a3bd3715 (patch) | |
tree | 75b1444898aabcd90b9e4731f4eb1d56a078c790 /mesonbuild/scripts/gtkdochelper.py | |
parent | be04aa2a0b00d123aae78da2448a216f7e3201b9 (diff) | |
download | meson-60716fcd6debd9f1ebca0091c945df16a3bd3715.zip meson-60716fcd6debd9f1ebca0091c945df16a3bd3715.tar.gz meson-60716fcd6debd9f1ebca0091c945df16a3bd3715.tar.bz2 |
Use universal_newlines=True for all Popen calls
Instead of adding it everywhere manually, create a wrapper called
mesonlib.Popen_safe and use that everywhere that we call an executable
and extract its output.
This will also allow us to tweak it to do more/different things if
needed for some locales and/or systems.
Closes #1079
Diffstat (limited to 'mesonbuild/scripts/gtkdochelper.py')
-rwxr-xr-x | mesonbuild/scripts/gtkdochelper.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/mesonbuild/scripts/gtkdochelper.py b/mesonbuild/scripts/gtkdochelper.py index 14de486..0cfd644 100755 --- a/mesonbuild/scripts/gtkdochelper.py +++ b/mesonbuild/scripts/gtkdochelper.py @@ -17,7 +17,7 @@ import sys, os import subprocess import shutil import argparse -from ..mesonlib import MesonException +from ..mesonlib import MesonException, Popen_safe from . import destdir_join parser = argparse.ArgumentParser() @@ -46,15 +46,13 @@ parser.add_argument('--mode', dest='mode', default='') parser.add_argument('--installdir', dest='install_dir') def gtkdoc_run_check(cmd, cwd): - p = subprocess.Popen(cmd, cwd=cwd, - stdout=subprocess.PIPE, stderr=subprocess.PIPE) - (stde, stdo) = p.communicate() + # Put stderr into stdout since we want to print it out anyway. + # This preserves the order of messages. + p, out = Popen_safe(cmd, cwd=cwd, stderr=subprocess.STDOUT)[0:2] if p.returncode != 0: err_msg = ["{!r} failed with status {:d}".format(cmd[0], p.returncode)] - if stde: - err_msg.append(stde.decode(errors='ignore')) - if stdo: - err_msg.append(stdo.decode(errors='ignore')) + if out: + err_msg.append(out) raise MesonException('\n'.join(err_msg)) def build_gtkdoc(source_root, build_root, doc_subdir, src_subdirs, |