Browse Source

Windows: Restore suppression of error report popups in CI builds

On Windows, libuv uses `_CrtSetReportHook` to install a handler it uses
to suppress assertions on invalid file descriptors in `_get_osfhandle`.
This removes the handler we install in CI environments to suppress
interactive popups.  Move installation of our handler to after libuv is
initialized so that our handler is actually used.

Unfortunately this also removes libuv's handler and so may cause Debug
builds under CI to abort on invalid file descriptors instead of simply
converting them to `INVALID_HANDLE_VALUE`.  If this becomes a problem
we may need to modify libuv to make its hook more configurable.
Brad King 6 years ago
parent
commit
a4c19cb895
4 changed files with 2 additions and 3 deletions
  1. 0 1
      Source/CPack/cpack.cxx
  2. 2 0
      Source/cmSystemTools.cxx
  3. 0 1
      Source/cmakemain.cxx
  4. 0 1
      Source/ctest.cxx

+ 0 - 1
Source/CPack/cpack.cxx

@@ -115,7 +115,6 @@ int main(int argc, char const* const* argv)
   argc = args.argc();
   argv = args.argv();
 
-  cmSystemTools::EnableMSVCDebugHook();
   cmSystemTools::InitializeLibUV();
   cmSystemTools::FindCMakeResources(argv[0]);
   cmCPackLog log;

+ 2 - 0
Source/cmSystemTools.cxx

@@ -814,6 +814,8 @@ void cmSystemTools::InitializeLibUV()
 #  else
   _fmode = _O_TEXT;
 #  endif
+  // Replace libuv's report handler with our own to suppress popups.
+  cmSystemTools::EnableMSVCDebugHook();
 #endif
 }
 

+ 0 - 1
Source/cmakemain.cxx

@@ -683,7 +683,6 @@ int main(int ac, char const* const* av)
   ac = args.argc();
   av = args.argv();
 
-  cmSystemTools::EnableMSVCDebugHook();
   cmSystemTools::InitializeLibUV();
   cmSystemTools::FindCMakeResources(av[0]);
   if (ac > 1) {

+ 0 - 1
Source/ctest.cxx

@@ -164,7 +164,6 @@ int main(int argc, char const* const* argv)
   argv = encoding_args.argv();
 
   cmSystemTools::DoNotInheritStdPipes();
-  cmSystemTools::EnableMSVCDebugHook();
   cmSystemTools::InitializeLibUV();
   cmSystemTools::FindCMakeResources(argv[0]);