Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
git-cmd.exe has a bad behavior when it receives CTRL-C event. A command line shell must handle the events.
For example, CTRL-C should be used to terminate the current command and not to terminate the shell himself.
When git-cmd.exe is launched, git-cmd.exe launches a child process (for example cmd.exe).
git-cmd.exe monitors the child process. When the child process exits, git-cmd.exe exits too.
When the user presses CTRL-C, the Windows console receives Windows messages for WM_KEYDOWN/WM_KEYUP.
Then the TranslateMessage function generates a CTRL-C event.
The CTRL-C event is handled by the Control Handler Function.
When a CTRL_BREAK_EVENT, CTRL_LOGOFF_EVENT, or CTRL_SHUTDOWN_EVENT signal is received, the control handler returns FALSE. Doing this causes the signal to be passed to the next control handler function. If no other control handlers have been registered or none of the registered handlers returns TRUE, the default handler will be used, resulting in the process being terminated.
cmd.exe Control Handler function terminates the current command and returns FALSE.
git-cmd.exe has no Control Handler Function registered. So git-cmd.exe is terminated.
When git-cmd.exe is used with programs like ConsoleZ, ConsoleZ injects a dll in git-cmd.exe and monitors this process.
When the user presses CTRL-C, git-cmd is terminated and so the ConsoleZ's tab is closed.
To fix this behavior, we can simply register a Control Handler function that returns TRUE (for all events). In this case the only way to exit this program is the launched command end.
Signed-off-by: Christophe Bucher Developer [email protected]