C++ Makefile build cannot be canceled using Windows 7, Eclipse CDT, MinGW and MSYS2

♀尐吖头ヾ 提交于 2019-12-24 00:58:14

问题


I'm maintaining a C++ build system running on Windows and consisting of the named components. When we upgraded from Windows XP to Windows 7 some time ago we noticed that builds could be canceled any more, the Eclipse Cancel button just grays but the build always runs to the end. We further found that by using MSYS instead of MSYS2, the build can be canceled also in Windows 7, but the multicore build (e.g. make -j4) hangs right from the start (while working with MSYS2). We need multicore, so that's no solution.

We did some research and came to the conclusion that MSYS2 starts the make process using the WinAPI process creation flag CREATE_NEW_PROCESS_GROUP. We suppose this flag is not executed in Windows XP explaning why caneling works there.

We read that CREATE_NEW_PROCESS_GROUP causes another WinAPI call SetConsoleCtrlHandler(NULL,TRUE) which in turn causes that Ctrl-C gets disabled, the process may only be terminated by Ctrl-Break. We could verify this behavior by testing our build from the command line.

What is the intended solution for this problem? Is it possible to have Eclipse send Ctrl-Break instead of Ctrl-C when pressing Cancel? Or is our MSYS2 misconfigured and it should not suppress Ctrl-C for the build process? Or is our analysis garbage and the problem is something completely different?

来源:https://stackoverflow.com/questions/34292325/c-makefile-build-cannot-be-canceled-using-windows-7-eclipse-cdt-mingw-and-ms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!