summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.van.berkom@gmail.com>2018-08-30 12:32:22 +0000
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2018-08-30 12:32:22 +0000
commitb83f7fa1c33f864288685d93f054c2966c94709a (patch)
tree6c3900e28bfbdaafd3de0d12a69b2510dad7897b
parent82305517b4aa4a6af197159ad0ca4691c1739822 (diff)
parent6d438496833a1b9ad40baf9d46d8cea6d1913d35 (diff)
downloadbuildstream-b83f7fa1c33f864288685d93f054c2966c94709a.tar.gz
Merge branch 'tristan/atomic-cache-size-file-1.2' into 'bst-1.2'
_artifactcache/artifactcache.py: Write the cache_size file atomically See merge request BuildStream/buildstream!763
-rw-r--r--buildstream/_artifactcache/artifactcache.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/buildstream/_artifactcache/artifactcache.py b/buildstream/_artifactcache/artifactcache.py
index adfc07748..654b675a2 100644
--- a/buildstream/_artifactcache/artifactcache.py
+++ b/buildstream/_artifactcache/artifactcache.py
@@ -571,7 +571,7 @@ class ArtifactCache():
def _write_cache_size(self, size):
assert isinstance(size, int)
size_file_path = os.path.join(self.context.artifactdir, CACHE_SIZE_FILE)
- with open(size_file_path, "w") as f:
+ with utils.save_file_atomic(size_file_path, "w") as f:
f.write(str(size))
# _read_cache_size()