Skip to content

Commit 166fca2

Browse files
committed
Merge branch 'consolez'
This fixes an issue where the Git wrapper would terminate upon Ctrl+C, even in the case when its child process would *not* terminate. Note: while the original intention was to fix running Git Bash in ConsoleZ, the bug fix applies also to running C:\Program Files\Git\bin\bash -l -i in a cmd window. Signed-off-by: Johannes Schindelin <[email protected]>
2 parents f455773 + 1a7a5f7 commit 166fca2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

compat/win32/git-wrapper.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,8 +651,16 @@ int main(void)
651651
working_directory, /* use parent's */
652652
&si, &pi);
653653
if (br) {
654-
if (wait)
654+
if (wait) {
655+
/*
656+
* Ignore Ctrl+C: the called process needs
657+
* to handle this event correctly, then we
658+
* quit, too.
659+
*/
660+
SetConsoleCtrlHandler(NULL, TRUE);
655661
WaitForSingleObject(pi.hProcess, INFINITE);
662+
SetConsoleCtrlHandler(NULL, FALSE);
663+
}
656664
if (!GetExitCodeProcess(pi.hProcess, (DWORD *)&r))
657665
print_error(L"error reading exit code",
658666
GetLastError());

0 commit comments

Comments
 (0)