meson: skip captured write if content didn't change

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
pull/5654/head
Marc-André Lureau 5 years ago committed by Nirbheek Chauhan
parent 7803056ef2
commit 451a32d1c8
  1. 11
      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:

Loading…
Cancel
Save