CTRL C doesn't work properly on gitbash #11165

Closed
opened 2026-01-31 02:40:17 +00:00 by claunia · 24 comments
Owner

Originally created by @shirshak55 on GitHub (Oct 25, 2020).

Environment

Windows build number: [run `[Environment]::OSVersion` for powershell, or `ver` for cmd]
Windows Terminal version (if applicable): v1.3.2651.0

Any other software? Gitbash

Steps to reproduce

Expected behavior

Ctrl C works on gitbash when i run tsc --watch (tsc is microsoft typescript compiler) . But in windows terminal CTRL + C doesn't work it only response once typescript --watch is fully ready. I would like to ctrl +c before tsc --watch command start to be ready.

Its not just this app but most cli apps i use have similar issue.

Actual behavior

When i do ctrl + c it stucks for few moment till command line is fully ready and only it interrupts the program.

Originally created by @shirshak55 on GitHub (Oct 25, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: [run `[Environment]::OSVersion` for powershell, or `ver` for cmd] Windows Terminal version (if applicable): v1.3.2651.0 Any other software? Gitbash ``` # Steps to reproduce <!-- A description of how to trigger this bug. --> # Expected behavior Ctrl C works on gitbash when i run tsc --watch (tsc is microsoft typescript compiler) . But in windows terminal CTRL + C doesn't work it only response once typescript --watch is fully ready. I would like to ctrl +c before tsc --watch command start to be ready. Its not just this app but most cli apps i use have similar issue. <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> # Actual behavior <!-- What's actually happening? --> When i do ctrl + c it stucks for few moment till command line is fully ready and only it interrupts the program.
claunia added the Needs-TriageNeeds-Tag-FixNeeds-Author-FeedbackProduct-Terminal labels 2026-01-31 02:40:17 +00:00
Author
Owner

@DHowett commented on GitHub (Oct 25, 2020):

Does this happen outside of Windows Terminal?

It is possible that the program is not ready to respond to ^C yet. This is a normal thing.

@DHowett commented on GitHub (Oct 25, 2020): Does this happen outside of Windows Terminal? It is possible that the program is not ready to respond to ^C yet. This is a normal thing.
Author
Owner

@shirshak55 commented on GitHub (Oct 25, 2020):

No it doesn't happen in gitbash
but it happens in windows terminal

Yea program may not respond. Is there forceful way to ctrl +c as far as i know gitbash on windows doesn't support ctrl \ unfortunately.

@shirshak55 commented on GitHub (Oct 25, 2020): No it doesn't happen in gitbash but it happens in windows terminal Yea program may not respond. Is there forceful way to ctrl +c as far as i know gitbash on windows doesn't support ctrl \ unfortunately.
Author
Owner

@svn-dys commented on GitHub (Nov 2, 2020):

I am also seeing this through my gitbash tab. Cannot close out a chrome instance with "CTRL + C". Git bash doesn't reproduce this effect - only WT.

Version: 1.3.2651.0

@svn-dys commented on GitHub (Nov 2, 2020): I am also seeing this through my gitbash tab. Cannot close out a chrome instance with "CTRL + C". Git bash doesn't reproduce this effect - only WT. Version: 1.3.2651.0
Author
Owner

@shirshak55 commented on GitHub (Nov 2, 2020):

Its so annoying. Windows terminal responds like after 20 seconds for ctrl +c :(

@shirshak55 commented on GitHub (Nov 2, 2020): Its so annoying. Windows terminal responds like after 20 seconds for ctrl +c :(
Author
Owner

@zadjii-msft commented on GitHub (Nov 2, 2020):

Is the command that you're trying to send ^C to actively outputting text when you're pressing Ctrl+C?

This is going to sound insane, but what happens if you do something like hit Ctrl+C, then resize the window a little bigger or smaller (at least one row/column different in size)? Does that cause the ^C to get handled immediately?

@zadjii-msft commented on GitHub (Nov 2, 2020): Is the command that you're trying to send `^C` to actively outputting text when you're pressing <kbd>Ctrl+C</kbd>? This is going to sound insane, but what happens if you do something like hit <kbd>Ctrl+C</kbd>, then resize the window a little bigger or smaller (at least one row/column different in size)? Does that cause the `^C` to get handled immediately?
Author
Owner

@shirshak55 commented on GitHub (Nov 2, 2020):

@zadjii-msft no windows terminal doesn't show ^C . The issue is hisen bug. Sometime Ctrl + C works sometime it doesn't. I have been confused so much with this issue. And after 20 seconds or 1 minute if I do ctrl + c it works . I am unable to understand whats happening.

Regarding window sizing i haven't checked it will let you know.

@shirshak55 commented on GitHub (Nov 2, 2020): @zadjii-msft no windows terminal doesn't show ^C . The issue is hisen bug. Sometime `Ctrl + C` works sometime it doesn't. I have been confused so much with this issue. And after 20 seconds or 1 minute if I do ctrl + c it works . I am unable to understand whats happening. Regarding window sizing i haven't checked it will let you know.
Author
Owner

@zadjii-msft commented on GitHub (Nov 2, 2020):

Okay, but like, with the command actively outputting text when you try pressing Ctrl+C? We had a bug a few years ago where there was weird locking issue where ^C signals wouldn't get delivered until something else happened to the console server, something that wasn't input. So you could press Ctrl+C as many times as you wanted, but they wouldn't get processed until the commandline application (tsc --watch in this case) actually output some new text.

The resizing thing is just me spitballing, trying to trick the commandline into outputting something, breaking the lock. I suppose you could achieve the same thing by pressing Ctrl+C, then editing & saving a .ts file that's being watched, and seeing if the ^C gets handled immediately.

@zadjii-msft commented on GitHub (Nov 2, 2020): Okay, but like, with the command actively outputting text when you try pressing <kbd>Ctrl+C</kbd>? We had a bug a few years ago where there was weird locking issue where `^C` signals wouldn't get delivered until _something else_ happened to the console server, something that _wasn't_ input. So you could press <kbd>Ctrl+C</kbd> as many times as you wanted, but they wouldn't get processed until the commandline application (`tsc --watch` in this case) actually output some new text. The resizing thing is just me spitballing, trying to trick the commandline into outputting something, breaking the lock. I suppose you could achieve the same thing by pressing <kbd>Ctrl+C</kbd>, then editing & saving a `.ts` file that's being watched, and seeing if the `^C` gets handled immediately.
Author
Owner

@svn-dys commented on GitHub (Nov 2, 2020):

Nothing I do will execute CTRL + C to the command line. Resizing etc.

Anything I can do to see errors etc?

@svn-dys commented on GitHub (Nov 2, 2020): Nothing I do will execute `CTRL + C` to the command line. Resizing etc. Anything I can do to see errors etc?
Author
Owner

@shirshak55 commented on GitHub (Nov 2, 2020):

i tried resizing and ctrl + c is still not working for some commands. It doesn't happen two me but happens like 1 out of 10time. and I have to close terminal manually . I wish i could open tab in same folder and close that hanged tab. But currently the folder doesn't open in same location that previous tab was previously making this problem more worst :(

@shirshak55 commented on GitHub (Nov 2, 2020): i tried resizing and ctrl + c is still not working for some commands. It doesn't happen two me but happens like 1 out of 10time. and I have to close terminal manually . I wish i could open tab in same folder and close that hanged tab. But currently the folder doesn't open in same location that previous tab was previously making this problem more worst :(
Author
Owner

@wsy commented on GitHub (Mar 29, 2021):

I encountered same issue since many months ago, and this bug is stil there.
I'm using Windows Terminal (Windows App Store version v1.6.10571.0) with PSCore 7.1.3

I type ping -t <someIPAddress>

image

I can Ctrl+Break and print statistic information.

image

But I can't Ctrl+C and stop ping command.
This does NOT repro EVERY TIME. So I guess this will be hard to fix.

I suggest you open many tabs in Windows Terminal and ping some IP address for many hours with "-t" parameter and then try to terminate them with Ctrl+C shortcut.

@wsy commented on GitHub (Mar 29, 2021): I encountered same issue since many months ago, and this bug is stil there. I'm using Windows Terminal (Windows App Store version ```v1.6.10571.0```) with PSCore ```7.1.3``` I type ```ping -t <someIPAddress>``` > ![image](https://user-images.githubusercontent.com/2684991/112823720-36a58280-90bc-11eb-851d-20f7dcd2db6a.png) I can Ctrl+Break and print statistic information. > ![image](https://user-images.githubusercontent.com/2684991/112823999-90a64800-90bc-11eb-88e4-0035d9dd4abc.png) But I can't Ctrl+C and stop ping command. This does NOT repro EVERY TIME. So I guess this will be hard to fix. I suggest you open many tabs in Windows Terminal and ping some IP address for many hours with "-t" parameter and then try to terminate them with Ctrl+C shortcut.
Author
Owner

@armordog commented on GitHub (Apr 27, 2021):

I can reproduce this running gitbash in Terminal by holding ctrl and rapidly pressing C several times.

@armordog commented on GitHub (Apr 27, 2021): I can reproduce this running gitbash in Terminal by _holding_ `ctrl` and rapidly pressing `C` several times.
Author
Owner

@DHowett commented on GitHub (Apr 28, 2021):

Sorry, you can reproduce it not working by holding ctrl and rapidly pressing C several times? But if you do not do it rapidly, it works just fine? I don't understand.

@DHowett commented on GitHub (Apr 28, 2021): Sorry, you can reproduce it _not_ working by holding ctrl and rapidly pressing C several times? But if you do not do it rapidly, it works just fine? I don't understand.
Author
Owner

@armordog commented on GitHub (Apr 28, 2021):

Sorry. =]
If I hold Ctrl and then press "C" rapidly several times, I will get the stall.
But if I press "C" less often it prints ^C to the terminal and I get a new prompt, as usual.

Here's an example of me holding down ctrl+c (frame-rate is low but you can see what's happening).
It stays unresponsive for almost exactly 60 seconds.

ctrlcgif


Also, for what it's worth, running exit after it becomes responsive again shows [Process exited with code 130]

@armordog commented on GitHub (Apr 28, 2021): Sorry. =] If I hold Ctrl and then press "C" rapidly several times, I will get the stall. But if I press "C" less often it prints `^C` to the terminal and I get a new prompt, as usual. Here's an example of me holding down ctrl+c (frame-rate is low but you can see what's happening). It stays unresponsive for almost exactly 60 seconds. ![ctrlcgif](https://user-images.githubusercontent.com/1992702/116340421-feb15e00-a793-11eb-8473-26bb0b782f69.gif) --- Also, for what it's worth, running `exit` after it becomes responsive again shows `[Process exited with code 130]`
Author
Owner

@KalleOlaviNiemitalo commented on GitHub (Apr 28, 2021):

Also, for what it's worth, running exit after it becomes responsive again shows [Process exited with code 130]

That is normal; ^C causes the shell to set ? = 128 + SIGINT = 130, `exit` causes the shell process to exit with the current value of ?, and Windows Terminal then displays the value. You can disable that by changing the closeOnExit setting.

@KalleOlaviNiemitalo commented on GitHub (Apr 28, 2021): > Also, for what it's worth, running `exit` after it becomes responsive again shows `[Process exited with code 130]` That is normal; ^C causes the shell to set $? = 128 + SIGINT = 130, `exit` causes the shell process to exit with the current value of $?, and Windows Terminal then displays the value. You can disable that by changing the [closeOnExit](https://docs.microsoft.com/en-us/windows/terminal/customize-settings/profile-advanced#profile-termination-behavior) setting.
Author
Owner

@armordog commented on GitHub (Apr 28, 2021):

@KalleOlaviNiemitalo
Oh weird, I'd never noticed that ^C always caused the exit code to be set. =]

@armordog commented on GitHub (Apr 28, 2021): @KalleOlaviNiemitalo Oh weird, I'd never noticed that ^C always caused the exit code to be set. =]
Author
Owner

@armordog commented on GitHub (May 5, 2022):

When this happens, is there any way to determine what is unresponsive?
If it's Git Bash or Terminal?

@armordog commented on GitHub (May 5, 2022): When this happens, is there any way to determine what is unresponsive? If it's Git Bash or Terminal?
Author
Owner

@MohamedKarrab commented on GitHub (Jul 4, 2022):

I have the same issue with ctrl + c it prints ^C and it doesn't copy,and if I copy something from outside the bash and and try to paste it ctrl v doesn't work.

@MohamedKarrab commented on GitHub (Jul 4, 2022): I have the same issue with ctrl + c it prints ^C and it doesn't copy,and if I copy something from outside the bash and and try to paste it ctrl v doesn't work.
Author
Owner

@MohamedKarrab commented on GitHub (Jul 4, 2022):

The only solution I found so far is to actually use "ctrl" + "shift" for copy, and "ctrl" + "shift" + "ins" to paste.
or you can select text with your mouse (auto copied) and paste it with middle mouse button.
(You can find these in the options menu)

@MohamedKarrab commented on GitHub (Jul 4, 2022): The only solution I found so far is to actually use "ctrl" + "shift" for copy, and "ctrl" + "shift" + "ins" to paste. or you can select text with your mouse (auto copied) and paste it with middle mouse button. (You can find these in the options menu)
Author
Owner

@zadjii-msft commented on GitHub (Oct 26, 2022):

Hey so this thread has kinda become conflated with a bunch of different topics here. Let's just focus in on the original post here - Ctrl+C not sending a sigint in git bash, in Terminal, sometimes. However, this thread is a few years old now. Is this still happening/? We can't manage to get this to repro locally.

There's also been the mention of PowerShell/Win32-OpenSSH#1699 in linked threads. That issue's predicated on using ssh, but that could also be a factor here.

@zadjii-msft commented on GitHub (Oct 26, 2022): Hey so this thread has kinda become conflated with a bunch of different topics here. Let's just focus in on the original post here - Ctrl+C not sending a sigint in git bash, in Terminal, _sometimes_. However, this thread is a few years old now. Is this still happening/? We can't manage to get this to repro locally. There's also been the mention of PowerShell/Win32-OpenSSH#1699 in linked threads. That issue's predicated on using `ssh`, but that could also be a factor here.
Author
Owner

@svn-dys commented on GitHub (Oct 26, 2022):

@zadjii-msft I can no longer reproduce this issue.

Edit: Latest Version

@svn-dys commented on GitHub (Oct 26, 2022): @zadjii-msft I can no longer reproduce this issue. Edit: Latest Version
Author
Owner

@ghost commented on GitHub (Oct 30, 2022):

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost commented on GitHub (Oct 30, 2022): This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
Author
Owner

@ValYouW commented on GitHub (Dec 11, 2022):

@zadjii-msft Hi, I am still experiencing issues with ctrl+c not working properly within Windows Terminal.
Windows Terminal version: 1.15.2874.0

The setup is:
Windows Terminal
Git bash
And running a script via npm start

My git tab has this command line defined: "commandline": "\"%PROGRAMFILES%\\Git\\bin\\bash.exe\" -i -l"

Here is the script I'm using to reproduce the issue:

---
package.json
---
{
  "name": "testsignint",
  "version": "1.0.0",
  "description": "",
  "main": "a.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start":"node main.js"
  },
  "author": "",
  "license": "ISC"
}
---
main.js
---
let http = require('http');

http.createServer((req, res) => res.end('hi')).listen(5555, () => console.log('Listening'));

process.on('SIGINT', () => {
    console.log('SIGINT')
    process.exit(0);
});

When tapping ctrl+C I DO see the "SIGINT" console log but then the terminal is stuck for quite some time before returning to prompt.
It does NOT happen all the time, couldn't find any pattern or anything (like tapping "enters" when the server is listening etc)

Thx.

@ValYouW commented on GitHub (Dec 11, 2022): @zadjii-msft Hi, I am still experiencing issues with ctrl+c not working properly within Windows Terminal. Windows Terminal version: 1.15.2874.0 The setup is: Windows Terminal Git bash And running a script via `npm start` My git tab has this command line defined: `"commandline": "\"%PROGRAMFILES%\\Git\\bin\\bash.exe\" -i -l"` Here is the script I'm using to reproduce the issue: ```js --- package.json --- { "name": "testsignint", "version": "1.0.0", "description": "", "main": "a.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "start":"node main.js" }, "author": "", "license": "ISC" } ``` ```js --- main.js --- let http = require('http'); http.createServer((req, res) => res.end('hi')).listen(5555, () => console.log('Listening')); process.on('SIGINT', () => { console.log('SIGINT') process.exit(0); }); ``` When tapping `ctrl+C` I DO see the "SIGINT" console log but then the terminal is stuck for quite some time before returning to prompt. It does NOT happen all the time, couldn't find any pattern or anything (like tapping "enters" when the server is listening etc) Thx.
Author
Owner

@jsilveira commented on GitHub (Mar 13, 2024):

Same problem, makes the terminal really unusable. I think this issue should be reopened

@jsilveira commented on GitHub (Mar 13, 2024): Same problem, makes the terminal really unusable. I think this issue should be reopened
Author
Owner

@TheBestPessimist commented on GitHub (Sep 12, 2025):

I have this problem too

@TheBestPessimist commented on GitHub (Sep 12, 2025): I have this problem too
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#11165