Skip to content

Commit fc685f1

Browse files
binarycaching: apply try_write_back_zip_file only if the job was successful
1 parent dac97e8 commit fc685f1

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/vcpkg/binarycaching.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,11 +403,17 @@ namespace
403403
for (auto&& job : jobs)
404404
{
405405
const auto zip_resource = job.zip_resource;
406-
if (auto new_path = try_write_back_zip_file(zip_resource->path))
406+
407+
if (job.success)
407408
{
408-
Debug::print("Renamed ", zip_resource->path, " to ", *(new_path.get()), "\n");
409+
if (auto new_path = try_write_back_zip_file(zip_resource->path))
410+
{
411+
Debug::print("Renamed ", zip_resource->path, " to ", *(new_path.get()), "\n");
412+
continue;
413+
}
409414
}
410-
else if (zip_resource->to_remove == RemoveWhen::always)
415+
416+
if (zip_resource->to_remove == RemoveWhen::always)
411417
{
412418
m_fs.remove(zip_resource->path, IgnoreErrors{});
413419
Debug::print("Removed ", zip_resource->path, '\n');

0 commit comments

Comments
 (0)