summaryrefslogtreecommitdiff
path: root/mesonbuild/mesonlib.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-04-15 14:44:41 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2018-06-10 07:44:49 +0530
commit6df3cb7ab0e686ae976c67a24ce9664ffe5e1d86 (patch)
treebabfe469706c95e56783313fe97e4516b1e814d0 /mesonbuild/mesonlib.py
parent2d1fc25599adf349ae62504ce2197e2d821398f7 (diff)
downloadmeson-nirbheek/run_command_capture.tar.gz
run_command: Add new kwarg 'capture'nirbheek/run_command_capture
capture: false means we won't try to read the stdout at all. Closes https://github.com/mesonbuild/meson/issues/3364
Diffstat (limited to 'mesonbuild/mesonlib.py')
-rw-r--r--mesonbuild/mesonlib.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py
index e4951f957..21a6e29e2 100644
--- a/mesonbuild/mesonlib.py
+++ b/mesonbuild/mesonlib.py
@@ -796,22 +796,19 @@ def expand_arguments(args):
return None
return expended_args
-def Popen_safe(args, write=None, stderr=subprocess.PIPE, **kwargs):
+def Popen_safe(args, write=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs):
import locale
encoding = locale.getpreferredencoding()
if sys.version_info < (3, 6) or not sys.stdout.encoding or encoding.upper() != 'UTF-8':
- return Popen_safe_legacy(args, write=write, stderr=stderr, **kwargs)
- p = subprocess.Popen(args, universal_newlines=True,
- close_fds=False,
- stdout=subprocess.PIPE,
- stderr=stderr, **kwargs)
+ return Popen_safe_legacy(args, write=write, stdout=stdout, stderr=stderr, **kwargs)
+ p = subprocess.Popen(args, universal_newlines=True, close_fds=False,
+ stdout=stdout, stderr=stderr, **kwargs)
o, e = p.communicate(write)
return p, o, e
-def Popen_safe_legacy(args, write=None, stderr=subprocess.PIPE, **kwargs):
+def Popen_safe_legacy(args, write=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs):
p = subprocess.Popen(args, universal_newlines=False,
- stdout=subprocess.PIPE,
- stderr=stderr, **kwargs)
+ stdout=stdout, stderr=stderr, **kwargs)
if write is not None:
write = write.encode('utf-8')
o, e = p.communicate(write)