{"action":"created","issue":{"url":"https://api.github.com/repos/git-for-windows/git/issues/205","labels_url":"https://api.github.com/repos/git-for-windows/git/issues/205/labels{/name}","comments_url":"https://api.github.com/repos/git-for-windows/git/issues/205/comments","events_url":"https://api.github.com/repos/git-for-windows/git/issues/205/events","html_url":"https://github.com/git-for-windows/git/pull/205","id":89059393,"number":205,"title":"CTRL-C event kills the application","user":{"login":"cbucher","id":363759,"avatar_url":"https://avatars.githubusercontent.com/u/363759?v=3","gravatar_id":"","url":"https://api.github.com/users/cbucher","html_url":"https://github.com/cbucher","followers_url":"https://api.github.com/users/cbucher/followers","following_url":"https://api.github.com/users/cbucher/following{/other_user}","gists_url":"https://api.github.com/users/cbucher/gists{/gist_id}","starred_url":"https://api.github.com/users/cbucher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbucher/subscriptions","organizations_url":"https://api.github.com/users/cbucher/orgs","repos_url":"https://api.github.com/users/cbucher/repos","events_url":"https://api.github.com/users/cbucher/events{/privacy}","received_events_url":"https://api.github.com/users/cbucher/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/git-for-windows/git/labels/git","name":"git","color":"5319e7"},{"url":"https://api.github.com/repos/git-for-windows/git/labels/help%20wanted","name":"help wanted","color":"159818"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":22,"created_at":"2015-06-17T16:09:03Z","updated_at":"2015-06-22T14:00:51Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/git-for-windows/git/pulls/205","html_url":"https://github.com/git-for-windows/git/pull/205","diff_url":"https://github.com/git-for-windows/git/pull/205.diff","patch_url":"https://github.com/git-for-windows/git/pull/205.patch"},"body":"git-cmd.exe has a bad behavior when it receives CTRL-C event. A command line shell must handle the events.\r\nFor example, CTRL-C should be used to terminate the current command and not to terminate the shell himself.\r\n\r\nWhen git-cmd.exe is launched, git-cmd.exe launches a child process (for example cmd.exe).\r\ngit-cmd.exe monitors the child process. When the child process exits, git-cmd.exe exits too.\r\n\r\nWhen the user presses CTRL-C, the Windows console receives Windows messages for WM_KEYDOWN/WM_KEYUP.\r\nThen the TranslateMessage function generates a CTRL-C event.\r\n\r\nThe CTRL-C event is handled by the Control Handler Function.\r\nWhen 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.\r\n\r\ncmd.exe Control Handler function terminates the current command and returns FALSE.\r\ngit-cmd.exe has no Control Handler Function registered. So git-cmd.exe is terminated.\r\n\r\nWhen git-cmd.exe is used with programs like ConsoleZ, ConsoleZ injects a dll in git-cmd.exe and monitors this process.\r\nWhen the user presses CTRL-C, git-cmd is terminated and so the ConsoleZ's tab is closed.\r\n\r\nTo 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.\r\n\r\nSigned-off-by: Christophe Bucher Developer <christophe.bucher@laposte.net>"},"comment":{"url":"https://api.github.com/repos/git-for-windows/git/issues/comments/114113161","html_url":"https://github.com/git-for-windows/git/pull/205#issuecomment-114113161","issue_url":"https://api.github.com/repos/git-for-windows/git/issues/205","id":114113161,"user":{"login":"dscho","id":127790,"avatar_url":"https://avatars.githubusercontent.com/u/127790?v=3","gravatar_id":"","url":"https://api.github.com/users/dscho","html_url":"https://github.com/dscho","followers_url":"https://api.github.com/users/dscho/followers","following_url":"https://api.github.com/users/dscho/following{/other_user}","gists_url":"https://api.github.com/users/dscho/gists{/gist_id}","starred_url":"https://api.github.com/users/dscho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dscho/subscriptions","organizations_url":"https://api.github.com/users/dscho/orgs","repos_url":"https://api.github.com/users/dscho/repos","events_url":"https://api.github.com/users/dscho/events{/privacy}","received_events_url":"https://api.github.com/users/dscho/received_events","type":"User","site_admin":false},"created_at":"2015-06-22T14:00:51Z","updated_at":"2015-06-22T14:00:51Z","body":"> > I strongly suspect that it is a ConsoleZ issue\r\n> \r\n> ConsoleZ issue for an issue you can reproduce without ConsoleZ?!?\r\n> ahem...\r\n\r\nWell, given that I *cannot* reproduce that freeze after 10 seconds, I assume that it is a ConsoleZ issue."}}