diff options
author | Aurelien Regat-Barrel <arb@cyberkarma.net> | 2022-10-30 00:26:37 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-10-30 12:42:19 (GMT) |
commit | d78671879b8779ef73b7b256f6d0eeb874ce6687 (patch) | |
tree | 5514ae5e3d1b5c219725688c07cf1b5663421856 /Source/cmFileCommand.cxx | |
parent | 59ae2543165b836d01b88fe0ba4e22ecd549e239 (diff) | |
download | CMake-d78671879b8779ef73b7b256f6d0eeb874ce6687.zip CMake-d78671879b8779ef73b7b256f6d0eeb874ce6687.tar.gz CMake-d78671879b8779ef73b7b256f6d0eeb874ce6687.tar.bz2 |
file(DOWNLOAD): Fix LOG with EXPECTED_HASH on download failure
When `file(DOWNLOAD <url> EXPECTED_HASH <hash> LOG <logs>)` fails to
download the requested file, the hash check will also fail and make the
command exit without actually returning the curl logs as requested
by the `LOG` argument. Report the log before checking the hash.
Issue: #24093
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r-- | Source/cmFileCommand.cxx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 421ff12..fe38db5 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2090,6 +2090,13 @@ bool HandleDownloadCommand(std::vector<std::string> const& args, ::curl_global_cleanup(); + // Ensure requested curl logs are returned (especially in case of failure) + // + if (!logVar.empty()) { + chunkDebug.push_back(0); + status.GetMakefile().AddDefinition(logVar, chunkDebug.data()); + } + // Explicitly flush/close so we can measure the md5 accurately. // if (!file.empty()) { @@ -2132,11 +2139,6 @@ bool HandleDownloadCommand(std::vector<std::string> const& args, } } - if (!logVar.empty()) { - chunkDebug.push_back(0); - status.GetMakefile().AddDefinition(logVar, chunkDebug.data()); - } - return true; #else status.SetError("DOWNLOAD not supported by bootstrap cmake."); |