Commit faff2ab0 authored by Committed by Brad KingBrowse files
Process: Wait for children to terminate on Ctrl+C.
The following applies to any KWSys console app on Windows or UNIX (e.g. cmake.exe): The default behavior of such an app when Ctrl+C is pressed is to call ExitProcess or _exit. If the user has a subprocess open (e.g. by way of cmake --build) when this happens, the subprocess will be orphaned because the kwsys-based program will immediately exit. This can lead to odd behavior such as the orphaned subprocess continuing to run and mix output with the operating system shell. We prevent this behavior on Windows by tracking all subprocesses and waiting for their termination when Ctrl+C is pressed before allowing the call to ExitProcess to proceed. On UNIX, we reap every single child process and then call _exit. Change-Id: Iebd2eedb1c06719e9797dd5b1309d473145476a8