5361 {
5362 const bool in_death_test_child_process =
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386 const internal::ScopedPrematureExitFile premature_exit_file(
5387 in_death_test_child_process
5388 ? nullptr
5390
5391
5392
5393 impl()->set_catch_exceptions(
GTEST_FLAG(catch_exceptions));
5394
5395#if GTEST_OS_WINDOWS
5396
5397
5398
5399
5400 if (impl()->catch_exceptions() || in_death_test_child_process) {
5401# if !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
5402
5403 SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT |
5404 SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);
5405# endif
5406
5407# if (defined(_MSC_VER) || GTEST_OS_WINDOWS_MINGW) && !GTEST_OS_WINDOWS_MOBILE
5408
5409
5410
5411 _set_error_mode(_OUT_TO_STDERR);
5412# endif
5413
5414# if defined(_MSC_VER) && !GTEST_OS_WINDOWS_MOBILE
5415
5416
5417
5418
5419
5421 _set_abort_behavior(
5422 0x0,
5423 _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
5424
5425
5426
5427
5428
5429 if (!IsDebuggerPresent()) {
5430 (void)_CrtSetReportMode(_CRT_ASSERT,
5431 _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
5432 (void)_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
5433 }
5434# endif
5435 }
5436#endif
5437
5439 impl(),
5441 "auxiliary test code (environments or event listeners)") ? 0 : 1;
5442}
Result HandleExceptionsInMethodIfSupported(T *object, Result(T::*method)(), const char *location)
const char * GetEnv(const char *name)