aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mesonlib.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2016-12-07 07:03:15 +0530
committerJussi Pakkanen <jpakkane@gmail.com>2016-12-11 01:59:58 +0200
commit60716fcd6debd9f1ebca0091c945df16a3bd3715 (patch)
tree75b1444898aabcd90b9e4731f4eb1d56a078c790 /mesonbuild/mesonlib.py
parentbe04aa2a0b00d123aae78da2448a216f7e3201b9 (diff)
downloadmeson-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/mesonlib.py')
-rw-r--r--mesonbuild/mesonlib.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py
index 4670685..622cd04 100644
--- a/mesonbuild/mesonlib.py
+++ b/mesonbuild/mesonlib.py
@@ -385,3 +385,10 @@ def expand_arguments(args):
print(e)
return None
return expended_args
+
+def Popen_safe(args, write=None, stderr=subprocess.PIPE, **kwargs):
+ p = subprocess.Popen(args, universal_newlines=True,
+ stdout=subprocess.PIPE,
+ stderr=stderr, **kwargs)
+ o, e = p.communicate(write)
+ return (p, o, e)