mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-04 21:00:17 -06:00
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
This commit is contained in:
committed by
Brad King
parent
59ae254316
commit
d78671879b
@@ -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.");
|
||||
|
||||
Reference in New Issue
Block a user