aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/vcpkg_Checks.cpp
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-10-12 11:22:25 -0700
committerGitHub <noreply@github.com>2017-10-12 11:22:25 -0700
commit85e6b1b36e734c0db50464b07b77589d63c3c875 (patch)
tree095289838517a64f06298b1a05ded47a7139d7d9 /toolsrc/src/vcpkg_Checks.cpp
parentd7a313c5c356e1641f18cd14ad0ac0c3901bc0bf (diff)
parent9c3f9582fb4541a59e4282269e4f6c9c7debcc3e (diff)
downloadvcpkg-85e6b1b36e734c0db50464b07b77589d63c3c875.tar.gz
vcpkg-85e6b1b36e734c0db50464b07b77589d63c3c875.zip
Merge branch 'master' into vtk-components
Diffstat (limited to 'toolsrc/src/vcpkg_Checks.cpp')
-rw-r--r--toolsrc/src/vcpkg_Checks.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/toolsrc/src/vcpkg_Checks.cpp b/toolsrc/src/vcpkg_Checks.cpp
index 2ad2d06ab..e7c9046a4 100644
--- a/toolsrc/src/vcpkg_Checks.cpp
+++ b/toolsrc/src/vcpkg_Checks.cpp
@@ -10,7 +10,7 @@ namespace vcpkg::Checks
{
[[noreturn]] static void cleanup_and_exit(const int exit_code)
{
- auto elapsed_us = GlobalState::timer.lock()->microseconds();
+ const auto elapsed_us = GlobalState::timer.lock()->microseconds();
auto metrics = Metrics::g_metrics.lock();
metrics->track_metric("elapsed_us", elapsed_us);
@@ -20,20 +20,25 @@ namespace vcpkg::Checks
SetConsoleCP(GlobalState::g_init_console_cp);
SetConsoleOutputCP(GlobalState::g_init_console_output_cp);
- ::exit(exit_code);
+ fflush(nullptr);
+
+ ::TerminateProcess(::GetCurrentProcess(), exit_code);
}
- static BOOL CtrlHandler(DWORD fdwCtrlType)
+ static BOOL ctrl_handler(DWORD fdw_ctrl_type)
{
{
auto locked_metrics = Metrics::g_metrics.lock();
- locked_metrics->track_property("CtrlHandler", std::to_string(fdwCtrlType));
+ locked_metrics->track_property("CtrlHandler", std::to_string(fdw_ctrl_type));
locked_metrics->track_property("error", "CtrlHandler was fired.");
}
cleanup_and_exit(EXIT_FAILURE);
}
- void register_console_ctrl_handler() { SetConsoleCtrlHandler((PHANDLER_ROUTINE)CtrlHandler, TRUE); }
+ void register_console_ctrl_handler()
+ {
+ SetConsoleCtrlHandler(reinterpret_cast<PHANDLER_ROUTINE>(ctrl_handler), TRUE);
+ }
[[noreturn]] void unreachable(const LineInfo& line_info)
{
@@ -52,9 +57,9 @@ namespace vcpkg::Checks
cleanup_and_exit(exit_code);
}
- [[noreturn]] void exit_with_message(const LineInfo& line_info, const CStringView errorMessage)
+ [[noreturn]] void exit_with_message(const LineInfo& line_info, const CStringView error_message)
{
- System::println(System::Color::error, errorMessage);
+ System::println(System::Color::error, error_message);
exit_fail(line_info);
}
@@ -62,15 +67,15 @@ namespace vcpkg::Checks
{
if (!expression)
{
- exit_with_message(line_info, "");
+ exit_with_message(line_info, Strings::EMPTY);
}
}
- void check_exit(const LineInfo& line_info, bool expression, const CStringView errorMessage)
+ void check_exit(const LineInfo& line_info, bool expression, const CStringView error_message)
{
if (!expression)
{
- exit_with_message(line_info, errorMessage);
+ exit_with_message(line_info, error_message);
}
}
}