diff options
author | Zsolt Parragi <zsolt.parragi@cancellar.hu> | 2018-11-06 19:40:18 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-02-08 19:49:20 (GMT) |
commit | 440b08e4f0f59f47b53eb8310832bd4a1b1eb912 (patch) | |
tree | 892129074956fe8006993048ead0067932a40266 /Source/CTest/cmProcess.cxx | |
parent | a3ec65c3e8758c5d70743a0241fd6838879fd950 (diff) | |
download | CMake-440b08e4f0f59f47b53eb8310832bd4a1b1eb912.zip CMake-440b08e4f0f59f47b53eb8310832bd4a1b1eb912.tar.gz CMake-440b08e4f0f59f47b53eb8310832bd4a1b1eb912.tar.bz2 |
CTest: Represent process exit codes as 64-bit signed integer
Exit code constants on Windows, such as `STATUS_NO_MEMORY` do not fit in
a 32-bit signed integer type. They do fit in an unsigned 32-bit type,
but for compatibility with UNIX semantics we treat exit codes as signed.
Use a 64-bit signed integer to handle both.
Diffstat (limited to 'Source/CTest/cmProcess.cxx')
-rw-r--r-- | Source/CTest/cmProcess.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index c03d004..cd2e2f7 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -11,7 +11,9 @@ #include <iostream> #include <signal.h> #include <string> -#if !defined(_WIN32) +#if defined(_WIN32) +# include "cm_kwiml.h" +#else # include <unistd.h> #endif #include <utility> @@ -353,7 +355,7 @@ void cmProcess::OnExit(int64_t exit_status, int term_signal) } // Record exit information. - this->ExitValue = static_cast<int>(exit_status); + this->ExitValue = exit_status; this->Signal = term_signal; this->TotalTime = std::chrono::steady_clock::now() - this->StartTime; // Because of a processor clock scew the runtime may become slightly @@ -539,7 +541,8 @@ std::string cmProcess::GetExitExceptionString() case STATUS_NO_MEMORY: default: char buf[1024]; - _snprintf(buf, 1024, "Exit code 0x%x\n", this->ExitValue); + const char* fmt = "Exit code 0x%" KWIML_INT_PRIx64 "\n"; + _snprintf(buf, 1024, fmt, this->ExitValue); exception_str.assign(buf); } #else |