diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2019-07-15 19:36:31 +0400 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2019-07-15 19:11:47 +0000 |
commit | 451a32d1c822ea28658242e03c6db3021df274ac (patch) | |
tree | dcd09cc848864a654afdd6d66eb060197dd345c6 /mesonbuild | |
parent | 7803056ef2a17c5a706335bcd876d31baf614280 (diff) | |
download | meson-451a32d1c822ea28658242e03c6db3021df274ac.zip meson-451a32d1c822ea28658242e03c6db3021df274ac.tar.gz meson-451a32d1c822ea28658242e03c6db3021df274ac.tar.bz2 |
meson: skip captured write if content didn't change
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/scripts/meson_exe.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/mesonbuild/scripts/meson_exe.py b/mesonbuild/scripts/meson_exe.py index 3fe327f..c1d0d64 100644 --- a/mesonbuild/scripts/meson_exe.py +++ b/mesonbuild/scripts/meson_exe.py @@ -84,8 +84,15 @@ def run_exe(exe): raise FileNotFoundError('Missing DLLs on calling {!r}'.format(exe.name)) if exe.capture and p.returncode == 0: - with open(exe.capture, 'wb') as output: - output.write(stdout) + skip_write = False + try: + with open(exe.capture, 'rb') as cur: + skip_write = cur.read() == stdout + except IOError: + pass + if not skip_write: + with open(exe.capture, 'wb') as output: + output.write(stdout) else: sys.stdout.buffer.write(stdout) if stderr: |