Console: git-for-windows tools don't handle CTRL + C and terminate

Created on 18 Sep 2015  路  22Comments  路  Source: cbucher/console

Hello,

I have Windows10 Pro x64, the CTRL + C now close the current tab (and the application if only 1 tab) instead of stopping the process in the tab...very anoying !
I've tried to reassign the keys but nothing changes...
Maybe the CTRL + C interrupt is a bit different in Windows 10 ?
Thank you for your help !

how to? false bug

Most helpful comment

I was able to get all my node processes to die directly from the Git Bash shell on Windows 10 by typing taskkill -F -IM node.exe - this ends all the node processes on my computer at once. I found I could also use taskkill //F //IM node.exe. Not sure why both - and // work in this context. Hope this helps!

All 22 comments

Sorry, i don't understand ?? Why do you think it is a false bug ??

Please follow these steps or close your issue.

ConsoleZ aero amd64 1, 14, 0, 15129
is elevated? no
UAC prefix "Administrateur聽: "
Tab (active): Vasygo
  View (active): 1. Vasygo
  is elevated? no
font index: 5
face name: Consolas
font familly: 54 MODERN vector true type
font weight: 400
font size: width=6 height=12
max window size: cols=182 rows=84
Monitors 2
  Flags 0
  DeviceID \\?\DISPLAY#LGD02D9#4&346c5183&0&UID67568640#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7}
  DeviceKey \Registry\Machine\System\CurrentControlSet\Control\Class\{4d36e96e-e325-11ce-bfc1-08002be10318}\0001
  DeviceName \\.\DISPLAY1\Monitor0
  DeviceString Generic PnP Monitor
  StateFlags 3
  Rect (-1920,0)x(-384,864)
  Work (-1920,0)x(-384,864)
  Flags 1  primary
  DeviceID \\?\DISPLAY#DEL405C#4&346c5183&0&UID52826880#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7}
  DeviceKey \Registry\Machine\System\CurrentControlSet\Control\Class\{4d36e96e-e325-11ce-bfc1-08002be10318}\0002
  DeviceName \\.\DISPLAY2\Monitor0
  DeviceString Alienware AW2310 (Digital)
  StateFlags 3
  Rect (0,0)x(1920,1080)
  Work (0,0)x(1920,1040)
Settings file C:\Users\Fred\AppData\Roaming\Console\console.xml
<?xml version="1.0"?>
<settings>
    <console change_refresh="10" refresh="100" rows="66" columns="182" buffer_rows="1000" buffer_columns="0" shell="ssh -T git@pluton" init_dir="D:\WWWroot" start_hidden="0" save_size="0">
        <colors background_text_opacity="255">
            <color id="0" r="0" g="43" b="54"/>
            <color id="1" r="38" g="139" b="210"/>
            <color id="2" r="133" g="153" b="0"/>
            <color id="3" r="42" g="161" b="152"/>
            <color id="4" r="220" g="50" b="47"/>
            <color id="5" r="211" g="54" b="130"/>
            <color id="6" r="181" g="137" b="0"/>
            <color id="7" r="238" g="232" b="213"/>
            <color id="8" r="128" g="128" b="128"/>
            <color id="9" r="131" g="148" b="150"/>
            <color id="10" r="88" g="110" b="117"/>
            <color id="11" r="147" g="161" b="161"/>
            <color id="12" r="203" g="75" b="22"/>
            <color id="13" r="108" g="113" b="196"/>
            <color id="14" r="101" g="123" b="131"/>
            <color id="15" r="255" g="255" b="255"/>
        </colors>
        <cursor style="0" r="255" g="255" b="255"/><background type="0" r="0" g="0" b="0"><image file="" relative="0" extend="0" position="0"><tint opacity="0" r="0" g="0" b="0"/></image></background></console>
    <appearance>
        <font name="Lucida Console" size="10" bold="0" italic="0" smoothing="0" extra_width="0" bold_intensified="0" italic_intensified="0">
            <color use="0" r="0" g="0" b="0"/>
        </font>
        <window title="Console" icon="" use_tab_icon="1" use_console_title="0" show_cmd="0" show_cmd_tabs="0" use_tab_title="1" trim_tab_titles="20" trim_tab_titles_right="0" main_title_format="?U([%u] )?N({%u} )%m" tab_title_format="%n. ?U([%u] )?N({%u} )%t"/>
        <controls show_menu="1" show_toolbar="1" show_statusbar="1" show_tabs="1" hide_single_tab="1" show_scrollbars="1" flat_scrollbars="1" tabs_on_bottom="0" show_searchbar="1" hide_tab_icons="0"/>
        <styles caption="1" resizable="1" taskbar_button="1" border="1" inside_border="2" tray_icon="1" quake_like="0" quake_animation_time="300" jumplist="0" integrated_ime="0">
            <selection_color r="255" g="255" b="255"/>
        </styles>
        <position x="-1" y="-1" dock="0" snap="0" z_order="0" save_position="0" w="-1" h="-1" save_size="0"/>
        <transparency type="0" active_alpha="255" inactive_alpha="255" r="0" g="0" b="0"/>
        <fullscreen start_in_fullscreen="0" fullscreen_monitor="0"/></appearance>
    <behavior>
        <copy_paste copy_on_select="1" clear_on_copy="1" no_wrap="1" trim_spaces="1" copy_newline_char="0" sensitive_copy="1" eol_spaces="1" rtf="1" include_left_delimiter="0" include_right_delimiter="0" left_delimiters=" ([" right_delimiters=" )]"/>
        <scroll page_scroll_rows="0"/>
        <tab_highlight flashes="3" stay_highligted="1"/>
        <close allow_closing_last_view="1" confirm_closing_multiple_views="1"/><focus follow_mouse="0"/><instance allow_multi="1"/><clone use_current_dir="1"/><search match_case="0" match_whole_word="0"/><runas use_credprov="1"/></behavior>
    <hotkeys use_scroll_lock="1">
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="settings"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="112" command="help"/>
        <hotkey ctrl="0" shift="0" alt="1" extended="0" code="115" command="exit"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="112" command="newtab1"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="113" command="newtab2"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="114" command="newtab3"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="115" command="newtab4"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="116" command="newtab5"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="117" command="newtab6"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="118" command="newtab7"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="119" command="newtab8"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="120" command="newtab9"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="121" command="newtab10"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="newtab11"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="newtab12"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="49" command="switchtab1"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="50" command="switchtab2"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="51" command="switchtab3"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="52" command="switchtab4"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="53" command="switchtab5"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="54" command="switchtab6"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="55" command="switchtab7"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="56" command="switchtab8"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="57" command="switchtab9"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="48" command="switchtab10"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="9" command="nexttab"/>
        <hotkey ctrl="1" shift="1" alt="0" extended="0" code="9" command="prevtab"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="87" command="closetab"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="82" command="renametab"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="nextview"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="prevview"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="leftview"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="rightview"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="topview"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="bottomview"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="dechsize"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="inchsize"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="decvsize"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="incvsize"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="closeview"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="detachview"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="attach"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="splithoriz"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="splitvert"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="clone"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="fullscreen"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="zoom100"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="zoominc"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="zoomdec"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="groupall"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="ungroupall"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="grouptab"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="ungrouptab"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="clear"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="1" code="45" command="copy"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="selectall"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="1" code="46" command="clear_selection"/>
        <hotkey ctrl="0" shift="1" alt="0" extended="1" code="45" command="paste"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="stopscroll"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="scrollrowup"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="scrollrowdown"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="scrollpageup"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="scrollpagedown"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="scrollcolleft"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="scrollcolright"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="scrollpageleft"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="scrollpageright"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="find"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="findnext"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="findprev"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="switchtransparency"/>
        <hotkey ctrl="1" shift="1" alt="0" extended="0" code="112" command="dumpbuffer"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="cmdMenu1"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="cmdMenu2"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="cmdMenu3"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="83" command="ctrlC"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="externalcmd1"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="externalcmd2"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="externalcmd3"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="externalcmd4"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="externalcmd5"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="externalcmd6"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="externalcmd7"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="externalcmd8"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="externalcmd9"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="externalcmd10"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="activate" win="0"/>
    </hotkeys>
    <mouse>
        <actions>
            <action ctrl="0" shift="0" alt="0" button="1" name="copy"/>
            <action ctrl="0" shift="1" alt="0" button="1" name="select"/>
            <action ctrl="0" shift="0" alt="0" button="0" name="select_column"/>
            <action ctrl="0" shift="0" alt="0" button="3" name="paste"/>
            <action ctrl="1" shift="0" alt="0" button="1" name="drag"/>
            <action ctrl="0" shift="0" alt="0" button="0" name="link"/>
            <action ctrl="0" shift="0" alt="0" button="2" name="menu"/>
            <action ctrl="0" shift="0" alt="0" button="0" name="menu2"/>
            <action ctrl="0" shift="0" alt="0" button="0" name="menu3"/>
        </actions>
    </mouse>
    <tabs>
        <tab title="Workdir" use_default_icon="0">
            <console shell="&quot;C:\ansicon\ansicon.exe&quot; &quot;C:\PortablePrograms\PortableGit-2.5.1-64-bit\bin\bash.exe&quot; --login -i" init_dir="D:\WWWroot\" priority="2" run_as_user="0" user="" net_only="0" run_as_admin="0"/>
            <cursor style="0" r="255" g="255" b="255"/>
            <background type="0" r="0" g="0" b="0">
                <image file="" relative="0" extend="0" position="0">
                    <tint opacity="0" r="0" g="0" b="0"/>
                </image>
            </background>
        </tab>
</tabs>
    <external_commands>
</external_commands></settings>

The behavior is not related to Windows 10.

image
bin/bash.exe is only an application which launches usr/bin/bash

image

when you press CTRL-C,

  • usr/bin/bash.exe processes the CTRL-C event (stop the current command, etc ...) and calls the next handler function (parent process)
  • bin/bash.exe doesn't set a handler function for CTRL-C event, the default handler terminates the process
  • ansicon.exe detects the termination of the process bin/bash.exe
  • ConsoleZ detects the termination of the process ansicon.exe

https://msdn.microsoft.com/en-us/library/windows/desktop/ms683242(v=vs.85).aspx

In conclusion, same problem as #262

Any news or progress on this issue ?

Hi, do you plan to provide us a new release with a bug fix in a near future ? Sincerely I can't continue working every day with such behavior.

It's git-for-windows that must be fixed...

Some Info, git-for-windows based on MinTTY, found a lot of tickets in https://github.com/mintty/mintty/issues?q=is%3Aissue+ctrl-c+is%3Aclosed for CTRL-C problems.

@savalle @mriehema It's a git-for-windows issue. Please file an issue there.

I was able to get all my node processes to die directly from the Git Bash shell on Windows 10 by typing taskkill -F -IM node.exe - this ends all the node processes on my computer at once. I found I could also use taskkill //F //IM node.exe. Not sure why both - and // work in this context. Hope this helps!

This was very helpful. I've been needing to kill long-running java tasks that were forked under Ant that aren't killed by Ctrl-C, and now that I've added this to my Git aliases I can do it with git kj:

    # kill java tasks
    kj = !sh -c 'taskkill -F -IM java.exe'

Tembrel you rock man.. this was sooo annoying.. at least there is your workaround.

Thanks. Unfortunately you've probably noticed that this kills __all__ Java processes, not just the ones you might think you're targeting. Still, better than nothing.

Yup you are right. it can kill other java processes but better than nothing. Especially because when I would try killing the java processes from the Task Manager it would give me Access Denied! Arrg! so this is certainly a cleaner/reliable way to kill the java processes (like the surefire java sub process forked from maven) when running them under mingw64.

What I've taken to doing in this situation is use https://docs.microsoft.com/en-us/sysinternals/downloads/process-explorer to kill of the process via the process explorer (like task manager with super powers). You can pretty easily identify the specific Java process you are after.

Why doesn't gitbash accept ctrl+c and crtl+v for copy pasting?

Press Ctrl+Alt+Enter
Worked for me.

Press Shift + q
Worked for me

Please Note: I had my doubts that the following would not work. For the sake of others I tried the approaches anyway just to prove it.

htabrizi - pressing CTRL+Alt+Enter just switches back and forth to full screen mode on Git Bash for me.. it doesnt terminate a parent - child multi java process.

imsantosh100- pressing Shift + q just enters upper case Q on the Git Bash screen it would kill the process. Maybe you added special config in Git Bash to override key short cut keys to make Shift + q do something that doesnt come out of the box?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MarcinOrlowski picture MarcinOrlowski  路  9Comments

khuongduybui picture khuongduybui  路  25Comments

rramsey picture rramsey  路  3Comments

liuyug picture liuyug  路  12Comments

Adambean picture Adambean  路  3Comments