Clean up temp files if there is no cache result.
Summary:
We create a temp file to uncache files to. However, if we miss the cache entirely, there
is no hit in the cache at all, we leave a zero-length file in the temp directory. Let's
clean that up to avoid cluttering the disk.
Test Plan:
buck test --all
Manually inspect the tmp dir for zero-length zip files
diff --git a/src/com/facebook/buck/rules/AbstractCachingBuildRule.java b/src/com/facebook/buck/rules/AbstractCachingBuildRule.java
index 2a1e8f0..ee147f5 100644
--- a/src/com/facebook/buck/rules/AbstractCachingBuildRule.java
+++ b/src/com/facebook/buck/rules/AbstractCachingBuildRule.java
@@ -412,6 +412,7 @@
// there.
CacheResult cacheResult = buildInfoRecorder.fetchArtifactForBuildable(zipFile, artifactCache);
if (!cacheResult.isSuccess()) {
+ zipFile.delete();
return cacheResult;
}