Atomic write
This commit is contained in:
parent
df1434d5a5
commit
25618c6a4d
|
@ -532,8 +532,11 @@ def run(options):
|
||||||
def write_intro_info(intro_info, info_dir):
|
def write_intro_info(intro_info, info_dir):
|
||||||
for i in intro_info:
|
for i in intro_info:
|
||||||
out_file = os.path.join(info_dir, 'intro-{}.json'.format(i[0]))
|
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)
|
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):
|
def generate_introspection_file(builddata: build.Build, backend: backends.Backend):
|
||||||
coredata = builddata.environment.get_coredata()
|
coredata = builddata.environment.get_coredata()
|
||||||
|
|
Loading…
Reference in New Issue