summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-05-23 16:00:22 +0200
committerJürg Billeter <j@bitron.ch>2019-05-23 16:20:37 +0200
commitfc5e3c33e2e36cd8f77d2897f701240356577879 (patch)
tree97569aaedf9cf089a730e66974ce7cbf1f897f13
parentb618670070027c892a84cd125dd028b708fb3c1b (diff)
downloadbuildstream-fc5e3c33e2e36cd8f77d2897f701240356577879.tar.gz
_artifactcache.py: Create artifact proto file atomically
-rw-r--r--src/buildstream/_artifactcache.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/buildstream/_artifactcache.py b/src/buildstream/_artifactcache.py
index 091b44dda..91ff762c7 100644
--- a/src/buildstream/_artifactcache.py
+++ b/src/buildstream/_artifactcache.py
@@ -611,7 +611,7 @@ class ArtifactCache(BaseCache):
# Write the artifact proto to cache
artifact_path = os.path.join(self.artifactdir, request.cache_key)
os.makedirs(os.path.dirname(artifact_path), exist_ok=True)
- with open(artifact_path, 'w+b') as f:
+ with utils.save_file_atomic(artifact_path, mode='wb') as f:
f.write(artifact.SerializeToString())
return True