aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mintro.py
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2018-12-31 14:27:20 +0100
committerDaniel Mensinger <daniel@mensinger-ka.de>2019-01-06 12:19:34 +0100
commit25618c6a4dd8e2c05d0e19ee19f4e6a5e735ef0c (patch)
tree4379d93e35d42d98f59c794441cf03e3e35bf51e /mesonbuild/mintro.py
parentdf1434d5a5ec099b6d54b70906210494e85f2c21 (diff)
downloadmeson-25618c6a4dd8e2c05d0e19ee19f4e6a5e735ef0c.zip
meson-25618c6a4dd8e2c05d0e19ee19f4e6a5e735ef0c.tar.gz
meson-25618c6a4dd8e2c05d0e19ee19f4e6a5e735ef0c.tar.bz2
Atomic write
Diffstat (limited to 'mesonbuild/mintro.py')
-rw-r--r--mesonbuild/mintro.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py
index cba10f3..e6782cb 100644
--- a/mesonbuild/mintro.py
+++ b/mesonbuild/mintro.py
@@ -532,8 +532,11 @@ def run(options):
def write_intro_info(intro_info, info_dir):
for i in intro_info:
out_file = os.path.join(info_dir, 'intro-{}.json'.format(i[0]))
- with open(out_file, 'w') as fp:
+ tmp_file = os.path.join(info_dir, 'tmp_dump.json')
+ with open(tmp_file, 'w') as fp:
json.dump(i[1], fp)
+ fp.flush() # Not sure if this is needed
+ os.replace(tmp_file, out_file)
def generate_introspection_file(builddata: build.Build, backend: backends.Backend):
coredata = builddata.environment.get_coredata()