aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/scripts
diff options
context:
space:
mode:
authorElliott Sales de Andrade <quantum.analyst@gmail.com>2016-08-24 04:35:15 -0400
committerElliott Sales de Andrade <quantum.analyst@gmail.com>2016-08-26 20:46:42 -0400
commit70d94a555004563178878b73274e345adff5b4e8 (patch)
treea5944eecebc2992e322e42364148d63ba73acda8 /mesonbuild/scripts
parentdcaf2d7b3d010526eb5035fec788f1b9a854262c (diff)
downloadmeson-70d94a555004563178878b73274e345adff5b4e8.zip
meson-70d94a555004563178878b73274e345adff5b4e8.tar.gz
meson-70d94a555004563178878b73274e345adff5b4e8.tar.bz2
Allow capturing command output of a custom target.
For commands that always output to stdout and don't have a "-o" or "--output" or some other similar option, this 'capture' setting allows the build to capture the result and place it in the output file.
Diffstat (limited to 'mesonbuild/scripts')
-rw-r--r--mesonbuild/scripts/meson_exe.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/mesonbuild/scripts/meson_exe.py b/mesonbuild/scripts/meson_exe.py
index f075fa0..cdfed09 100644
--- a/mesonbuild/scripts/meson_exe.py
+++ b/mesonbuild/scripts/meson_exe.py
@@ -59,6 +59,11 @@ 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)
+ return p.returncode
def run(args):
global options
@@ -68,7 +73,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:]))