Skip to content
  • James Johnston's avatar
    Process: Wait for children to terminate on Ctrl+C. · faff2ab0
    James Johnston authored and Brad King's avatar Brad King committed
    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
    faff2ab0