summaryrefslogtreecommitdiff
path: root/buildstream
diff options
context:
space:
mode:
Diffstat (limited to 'buildstream')
-rw-r--r--buildstream/_pipeline.py2
-rw-r--r--buildstream/element.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/buildstream/_pipeline.py b/buildstream/_pipeline.py
index 41f4b8cce..5afb42f52 100644
--- a/buildstream/_pipeline.py
+++ b/buildstream/_pipeline.py
@@ -927,7 +927,7 @@ class Pipeline():
with open(_site.build_all_template, "r") as f:
script_template = f.read()
- with open(script_path, "w") as script:
+ with utils.save_file_atomic(script_path, "w") as script:
script.write(script_template.format(modules=module_string))
os.chmod(script_path, stat.S_IEXEC | stat.S_IREAD)
diff --git a/buildstream/element.py b/buildstream/element.py
index 195365390..ef5e9ea76 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -688,7 +688,7 @@ class Element(Plugin):
script_path = os.path.join(directory, "build-" + self.normal_name)
with self.timed_activity("Writing build script", silent_nested=True):
- with open(script_path, "w") as script_file:
+ with utils.save_file_atomic(script_path, "w") as script_file:
script_file.write(script)
os.chmod(script_path, stat.S_IEXEC | stat.S_IREAD)