aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Christensen <philc@microsoft.com>2019-06-30 00:15:08 -0700
committerGitHub <noreply@github.com>2019-06-30 00:15:08 -0700
commit8e747d659c40775ce2a5a2e5d0230e4fd659ef57 (patch)
tree4b42201c3bd803644d181e267d436ebfb6afeece
parentbd72762f691ec7c4265ae0e041c655b6bc0ee1b3 (diff)
downloadvcpkg-8e747d659c40775ce2a5a2e5d0230e4fd659ef57.tar.gz
vcpkg-8e747d659c40775ce2a5a2e5d0230e4fd659ef57.zip
[vcpkg] fail archived port install when decompression fails (#7086)
* [vcpkg] fail port install when decompression fails * [vcpkg] clang-format
-rw-r--r--toolsrc/src/vcpkg/build.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp
index f826a4865..9694bce4c 100644
--- a/toolsrc/src/vcpkg/build.cpp
+++ b/toolsrc/src/vcpkg/build.cpp
@@ -594,7 +594,7 @@ namespace vcpkg::Build
return nullopt;
}
- static void decompress_archive(const VcpkgPaths& paths, const PackageSpec& spec, const fs::path& archive_path)
+ static int decompress_archive(const VcpkgPaths& paths, const PackageSpec& spec, const fs::path& archive_path)
{
auto& fs = paths.get_filesystem();
@@ -608,12 +608,13 @@ namespace vcpkg::Build
#if defined(_WIN32)
auto&& seven_zip_exe = paths.get_tool_exe(Tools::SEVEN_ZIP);
- System::cmd_execute_clean(Strings::format(
+ int result = System::cmd_execute_clean(Strings::format(
R"("%s" x "%s" -o"%s" -y >nul)", seven_zip_exe.u8string(), archive_path.u8string(), pkg_path.u8string()));
#else
- System::cmd_execute_clean(
+ int result = System::cmd_execute_clean(
Strings::format(R"(unzip -qq "%s" "-d%s")", archive_path.u8string(), pkg_path.u8string()));
#endif
+ return result;
}
// Compress the source directory into the destination file.
@@ -699,11 +700,16 @@ namespace vcpkg::Build
{
System::print2("Using cached binary package: ", archive_path.u8string(), "\n");
- decompress_archive(paths, spec, archive_path);
+ auto archive_result = decompress_archive(paths, spec, archive_path);
+
+ if (archive_result != 0)
+ {
+ System::print2("Failed to decompress archive package\n");
+ return BuildResult::BUILD_FAILED;
+ }
auto maybe_bcf = Paragraphs::try_load_cached_package(paths, spec);
- std::unique_ptr<BinaryControlFile> bcf =
- std::make_unique<BinaryControlFile>(std::move(maybe_bcf).value_or_exit(VCPKG_LINE_INFO));
+ auto bcf = std::make_unique<BinaryControlFile>(std::move(maybe_bcf).value_or_exit(VCPKG_LINE_INFO));
return {BuildResult::SUCCEEDED, std::move(bcf)};
}