diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-09-18 15:39:05 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-09-18 15:39:05 -0400 |
| commit | 84b963cb1b7cdc9b78eee315758914a9fae18064 (patch) | |
| tree | 73f3ab4c444a746239d933c64b393125d3475175 /src/cache_hash.cpp | |
| parent | 275b4100c0352cae6760797232489dba21bfb68f (diff) | |
| parent | 148fe2e99970ca880a8e10ded5af308e28bbc342 (diff) | |
| download | zig-84b963cb1b7cdc9b78eee315758914a9fae18064.tar.gz zig-84b963cb1b7cdc9b78eee315758914a9fae18064.zip | |
Merge remote-tracking branch 'origin/master' into llvm7
Diffstat (limited to 'src/cache_hash.cpp')
| -rw-r--r-- | src/cache_hash.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/cache_hash.cpp b/src/cache_hash.cpp index 5b1f55686a..0ac7615a3a 100644 --- a/src/cache_hash.cpp +++ b/src/cache_hash.cpp @@ -441,18 +441,13 @@ static Error write_manifest_file(CacheHash *ch) { } Error cache_final(CacheHash *ch, Buf *out_digest) { - Error err; - assert(ch->manifest_file_path != nullptr); - if (ch->manifest_dirty) { - if ((err = write_manifest_file(ch))) { - fprintf(stderr, "Warning: Unable to write cache file '%s': %s\n", - buf_ptr(ch->manifest_file_path), err_str(err)); - } - } // We don't close the manifest file yet, because we want to // keep it locked until the API user is done using it. + // We also don't write out the manifest yet, because until + // cache_release is called we still might be working on creating + // the artifacts to cache. uint8_t bin_digest[48]; int rc = blake2b_final(&ch->blake, bin_digest, 48); @@ -465,5 +460,15 @@ Error cache_final(CacheHash *ch, Buf *out_digest) { void cache_release(CacheHash *ch) { assert(ch->manifest_file_path != nullptr); + + Error err; + + if (ch->manifest_dirty) { + if ((err = write_manifest_file(ch))) { + fprintf(stderr, "Warning: Unable to write cache file '%s': %s\n", + buf_ptr(ch->manifest_file_path), err_str(err)); + } + } + os_file_close(ch->manifest_file); } |
