From 4ecfdd50b6a74df91d247773f0a7f0e0ed18acb5 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Thu, 10 Jul 2014 11:05:26 -0700 Subject: [PATCH] Suppress error dialogs on assertion failures in MinGW. --- test/test-main.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/test-main.cc b/test/test-main.cc index f4f2e789..036394cd 100644 --- a/test/test-main.cc +++ b/test/test-main.cc @@ -28,11 +28,17 @@ #include #ifdef _WIN32 +# include # include #endif int main(int argc, char **argv) { #ifdef _WIN32 + // Don't display any error dialogs. This also suppresses message boxes + // on assertion failures in MinGW where _set_error_mode/CrtSetReportMode + // doesn't help. + SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | + SEM_NOOPENFILEERRORBOX); // Disable message boxes on assertion failures. _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);