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.
This commit is contained in:
Brad King
2019-11-15 09:23:47 -05:00
parent 0b9f1cc96b
commit a4c19cb895
4 changed files with 2 additions and 3 deletions

View File

@@ -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;

View File

@@ -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
}

View File

@@ -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) {

View File

@@ -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]);