mirror of
https://github.com/git/git.git
synced 2026-01-18 06:34:21 +00:00
Merge branch 'ctrl-c'
This is part two of the Ctrl+C story, where part one is https://github.com/git-for-windows/MSYS2-packages/commit/f4fda0f30aa. Part one took care of extending the signal handling in the MSYS2 runtime such that non-MSYS2 processes "receive" a SIGINT by injecting a remote thread that runs kernel32!CtrlRoutine as if GenerateConsoleCtrlHandler() had been called (but in contrast to the latter, only one process is targeted at a time, not every process attached to the same Console) into the process that needs to be interrupted as well as into all of the spawned child processes. Part two now takes care of removing the misguided "kill all spawned children" atexit() handler, and it also installs a ConsoleCtrl handler to run Git's SIGINT handlers, such as the one waiting for the pager to exit. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
@@ -3374,6 +3374,14 @@ static void adjust_symlink_flags(void)
|
||||
|
||||
}
|
||||
|
||||
static BOOL WINAPI handle_ctrl_c(DWORD ctrl_type)
|
||||
{
|
||||
if (ctrl_type != CTRL_C_EVENT)
|
||||
return FALSE; /* we did not handle this */
|
||||
mingw_raise(SIGINT);
|
||||
return TRUE; /* we did handle this */
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
#ifdef _DEBUG
|
||||
@@ -3412,6 +3420,8 @@ int msc_startup(int argc, wchar_t **w_argv, wchar_t **w_env)
|
||||
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
|
||||
#endif
|
||||
|
||||
SetConsoleCtrlHandler(handle_ctrl_c, TRUE);
|
||||
|
||||
fsync_object_files = 1;
|
||||
maybe_redirect_std_handles();
|
||||
adjust_symlink_flags();
|
||||
@@ -3480,6 +3490,8 @@ void mingw_startup(void)
|
||||
wchar_t **wenv, **wargv;
|
||||
_startupinfo si;
|
||||
|
||||
SetConsoleCtrlHandler(handle_ctrl_c, TRUE);
|
||||
|
||||
fsync_object_files = 1;
|
||||
maybe_redirect_std_handles();
|
||||
adjust_symlink_flags();
|
||||
|
||||
Reference in New Issue
Block a user