Git Bash on Windows 10 ignores Ctrl + C

Viewed 5885

I encountered strange issue with git bash after starting using Windows 10.

Sometimes Ctrl+C (and Ctrl+X) doesn't terminate running command on git bash But I can't found any dependency which circumstances related to such bug

What could I do to avoid such issue or to break running command when ctrl+c doesn't help?

3 Answers

The same happened to me when using:

C:\Program Files\Git\bin\sh.exe --login -i

But it was NOT present with:

C:\Program Files\Git\usr\bin\sh.exe --login -i

There does not seem to be any difference in behavior between the sh.exe in a folder and the bash.exe in a particular folder. Namely, bin\bash.exe behaves the same as bin\sh.exe, and usr\bin\bash.exe behaves the same as usr\bin\sh.exe

I had the same issue during my maven (3.6.2) build.

When I was checking where the mvn command points to in my git-bash it turned out that the unix start script was invoked. As I'm a bit reluctant to change git-bash.exe to something else (you would never know what else breaks then) my solution was to introduce an alias in my ~/.bashrc:

alias mvn=mvn.cmd

This solved my issue for the moment. Other than spawning a cmd interpreter for the interpretation of the cmd file I did not find any drawbacks of it yet.

Regarding the cause: the mvn shell script uses exec as its last line, which I suspect as the cause. And this exec can only work with built-in git-bash commands; in our case maven execs the Windows java.exe.

This problem went away for me after upgrading Git for Windows from 2.23 to 2.37.

P.S. It always helps to include version information in your question.

Related