summaryrefslogtreecommitdiff
path: root/src/buildstream/_artifact.py
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-05-23 15:57:44 +0200
committerJürg Billeter <j@bitron.ch>2019-05-23 16:20:37 +0200
commitb618670070027c892a84cd125dd028b708fb3c1b (patch)
tree92bc9d6b74647afa8e879492a73bffea60eac5d2 /src/buildstream/_artifact.py
parent156affd4a33562bd383b5fc598fb95b9f99da0ea (diff)
downloadbuildstream-b618670070027c892a84cd125dd028b708fb3c1b.tar.gz
_artifact.py: Create artifact proto file atomically
Diffstat (limited to 'src/buildstream/_artifact.py')
-rw-r--r--src/buildstream/_artifact.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/buildstream/_artifact.py b/src/buildstream/_artifact.py
index b3ef005f0..90d25b4fe 100644
--- a/src/buildstream/_artifact.py
+++ b/src/buildstream/_artifact.py
@@ -183,7 +183,7 @@ class Artifact():
keys = utils._deduplicate([self._cache_key, self._weak_cache_key])
for key in keys:
path = os.path.join(self._artifactdir, element.get_artifact_name(key=key))
- with open(path, mode='w+b') as f:
+ with utils.save_file_atomic(path, mode='wb') as f:
f.write(artifact.SerializeToString())
return size