aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/scripts
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2016-08-27 13:42:13 +0300
committerGitHub <noreply@github.com>2016-08-27 13:42:13 +0300
commit4e050c3d9b545a8c8e136d5c8e7eb9cee988fbc6 (patch)
treefd64a026c5c364ce296230ac40f68224318efbc7 /mesonbuild/scripts
parent3ed1ff1c714e35beb82d02a9f1a1bccb992329b2 (diff)
parentb7757189e4eb8a17182d07cdcad53e8f5ebad0ce (diff)
downloadmeson-4e050c3d9b545a8c8e136d5c8e7eb9cee988fbc6.zip
meson-4e050c3d9b545a8c8e136d5c8e7eb9cee988fbc6.tar.gz
meson-4e050c3d9b545a8c8e136d5c8e7eb9cee988fbc6.tar.bz2
Merge pull request #712 from QuLogic/capturing-custom-target
Allow capturing command output of a custom target.
Diffstat (limited to 'mesonbuild/scripts')
-rw-r--r--mesonbuild/scripts/meson_exe.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/mesonbuild/scripts/meson_exe.py b/mesonbuild/scripts/meson_exe.py
index f075fa0..1a0fcda 100644
--- a/mesonbuild/scripts/meson_exe.py
+++ b/mesonbuild/scripts/meson_exe.py
@@ -59,6 +59,13 @@ def run_exe(exe):
stderr=subprocess.PIPE,
env=child_env,
cwd=exe.workdir)
+ stdout, stderr = p.communicate()
+ if exe.capture and p.returncode == 0:
+ with open(exe.capture, 'wb') as output:
+ output.write(stdout)
+ if stderr:
+ sys.stderr.buffer.write(stderr)
+ return p.returncode
def run(args):
global options
@@ -68,7 +75,7 @@ def run(args):
print(sys.argv[0] + ' [data file]')
exe_data_file = options.args[0]
exe = pickle.load(open(exe_data_file, 'rb'))
- run_exe(exe)
+ return run_exe(exe)
if __name__ == '__main__':
sys.exit(run(sys.argv[1:]))