You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Integrated Terminal: ctrl-c doesn't work in PowerShell and cmd.exe #9347
help wantedIssues identified as good community contribution opportunitiesterminalGeneral terminal issues that don't fall under another labelupstreamIssue identified as 'upstream' component related (exists outside of VS Code)windowsVS Code on Windows issues
Steps to Reproduce:
In version 1.3.1 I noticed that ctrl-c does not work and prevents exiting the current command. In my case I configured terminal to open PowerShell.
Example:
PS: >mkdir
cmdlet mkdir at command pipeline position 1
Supply values for the following parameters:
Path[0]: <<ctrl-c should exit but it does not work>>
Reacted by Josh Reichardt, Jayjay Montalbo, Dan Lewis, Ruiyang Li, farfromrefuge, Gabriel Isenberg, Tomáš Iser, Gonkers, Michael Delaney, Vitaly Rybnikov and 12 more
This might be caused by psreadline. I need to test it when I get a chance. I know I've noticed that it sometimes works and sometimes doesn't work. Also, sometimes if you click into a different part of the terminal and try it will work, but other times doing the same thing doesn't work. Ctrl+c doesn't work most often when a long running command is started. Shorter commands seem to have a better chance of worling if I recall. I often have to close the terminal out and open a new one because no matter what I try it won't stop.
I started work on documenting the impact of Psreadline on the terminal late last week here.
However, I got sick and am still not totally better so I haven't been able to work on it. I'm trying to help get as many of the issues documented with examples so we can start determining how we can improve the experience with powershell. Since windows 8 PSreadline is bundled with the OS and gets imported by default in ConesoleHost, so there are likely a lot of people who see these issues.
Another issue caused by Psreadline is ctrl+c for copy doesn't work in the prompt, only when highlighting in the output. At least I'm assuming it's caused by psreadline, haven't gotten to testing that yet.
I'll try to work on documenting the ctrl+c issues when I'm feeling better. I was starting to talk with David Wilson (@daviwil)Daniel Imms (@Tyriar) and a few others about it last week, but then I started to get sick.
I've recently started using the VSCode terminal for Powershell commands. (Windows v1.8.1.) I open the terminal, type Powershell then run commands.
I'm used to hitting control-C to clear the input line when I mistype a command or change my mind, but this does not clear the line in VSCode terminal as it does in the native console, so I have to backspace the entire line.
I mention this in case it's helpful/related to this issue, as it seems to me it might be.
I'm not sure how to fix this or any workarounds... I'm on Windows (7 Pro 64-bit), latest VS Code, and using Git Bash shell in the Terminal tab with User Settings "terminal.integrated.shell.windows": "C:\Program Files\Git\bin\bash.exe",
I also don't have a Break key on my laptop keyboard... and I'm right in the middle of a node session I need to restart. I can completely close the terminal but that's obnoxious.
Find the node process, and type "kill -id <node pid>" in PowerShell, or if it's the only node running, "kill -name node". We technically have PTY support on insider builds now, but the API isn't official yet, so you'd have to make it open a WSL pty currently.
I have same problem with git bash, but after press ctrl+c, if I wait like 5 minutes it will stop the "npm start" process for me.
I am using create-react-app typescript package
but if I use "docker-compose up" to run my docker container after I press ctrl+c it stop the container without problem.
After this problem I start using regular windows console and it works well, now my system works much faster! which is another problem with integrated terminal!
I find what was my problem.
for some reason I had this in my settings: "terminal.integrated.rendererType": "dom"
after I remove it it start working and it's much faster
It seems like the intent of Ctrl+C as "copy" is to maintain consistent behavior across the Editor and the Terminal areas in VS Code on Windows. Keeping that in mind, are there alternative commands that can be used in the Terminal to send an interrupt (SIGINT) to the running process? Can anyone (maybe Daniel Imms (@Tyriar)) explain how to create a new keyboard shortcut (Edit > Preferences > Keyboard Shortcuts) binding that sends a POSIX-style Ctrl+C to the Terminal while allowing the Windows Ctrl+C to remain "copy"?
ConPTY support is landing in the next Insiders build, this uses a new backend for the terminal on WIndows 10 build number 17692+, this is expected to fix many bugs in the terminal on Windows as we're adopting Microsoft's official pty API. For earlier versions winpty will still be used a many bugs will still remain (unless they're fixed in that project).
help wantedIssues identified as good community contribution opportunitiesterminalGeneral terminal issues that don't fall under another labelupstreamIssue identified as 'upstream' component related (exists outside of VS Code)windowsVS Code on Windows issues
Activity
Tyriar commentedon Jul 15, 2016
Brandon Padgett (@gerane) David Wilson (@daviwil) is this a recent regression?
daviwil commentedon Jul 16, 2016
I haven't tried it in previous builds so I'm not sure whether it ever worked.
gerane commentedon Jul 17, 2016
Yeah, it's never worked for me.
jmreicha commentedon Jan 1, 2017
Any update on this?
gerane commentedon Jan 1, 2017
This might be caused by psreadline. I need to test it when I get a chance. I know I've noticed that it sometimes works and sometimes doesn't work. Also, sometimes if you click into a different part of the terminal and try it will work, but other times doing the same thing doesn't work. Ctrl+c doesn't work most often when a long running command is started. Shorter commands seem to have a better chance of worling if I recall. I often have to close the terminal out and open a new one because no matter what I try it won't stop.
I started work on documenting the impact of Psreadline on the terminal late last week here.
https://github.com/gerane/LineEndings
However, I got sick and am still not totally better so I haven't been able to work on it. I'm trying to help get as many of the issues documented with examples so we can start determining how we can improve the experience with powershell. Since windows 8 PSreadline is bundled with the OS and gets imported by default in ConesoleHost, so there are likely a lot of people who see these issues.
Another issue caused by Psreadline is ctrl+c for copy doesn't work in the prompt, only when highlighting in the output. At least I'm assuming it's caused by psreadline, haven't gotten to testing that yet.
I'll try to work on documenting the ctrl+c issues when I'm feeling better. I was starting to talk with David Wilson (@daviwil) Daniel Imms (@Tyriar) and a few others about it last week, but then I started to get sick.
midnightfreddie commentedon Jan 6, 2017
I've recently started using the VSCode terminal for Powershell commands. (Windows v1.8.1.) I open the terminal, type Powershell then run commands.
I'm used to hitting control-C to clear the input line when I mistype a command or change my mind, but this does not clear the line in VSCode terminal as it does in the native console, so I have to backspace the entire line.
I mention this in case it's helpful/related to this issue, as it seems to me it might be.
28 remaining items
Metrics UI: Tell Windows users how to stop zcashd
gearskullguy commentedon Jun 6, 2018
I'm not sure how to fix this or any workarounds... I'm on Windows (7 Pro 64-bit), latest VS Code, and using Git Bash shell in the Terminal tab with User Settings "terminal.integrated.shell.windows": "C:\Program Files\Git\bin\bash.exe",
I also don't have a Break key on my laptop keyboard... and I'm right in the middle of a node session I need to restart. I can completely close the terminal but that's obnoxious.
parkovski commentedon Jun 6, 2018
Find the node process, and type "kill -id <node pid>" in PowerShell, or if it's the only node running, "kill -name node". We technically have PTY support on insider builds now, but the API isn't official yet, so you'd have to make it open a WSL pty currently.
saostad commentedon Aug 10, 2018
I have same problem with git bash, but after press ctrl+c, if I wait like 5 minutes it will stop the "npm start" process for me.
I am using create-react-app typescript package
but if I use "docker-compose up" to run my docker container after I press ctrl+c it stop the container without problem.
After this problem I start using regular windows console and it works well, now my system works much faster! which is another problem with integrated terminal!
saostad commentedon Aug 13, 2018
I find what was my problem.
for some reason I had this in my settings:
"terminal.integrated.rendererType": "dom"after I remove it it start working and it's much faster
Metrics UI: Tell Windows users how to stop zcashd
simeyla commentedon Aug 23, 2018
How quaint.
I remember the first time I used Ctrl+C.
It was 22 years ago. I'm pretty sure it worked every time :-/
Tyriar commentedon Aug 23, 2018
Update on this: I'm currently working on conpty support which is expected to fix this for newer versions of Windows 10 microsoft/node-pty#216
oliverjanik commentedon Sep 6, 2018
Will this fix the external terminal as well?
shinebayar-g commentedon Nov 2, 2018
2 years lol
openm commentedon Dec 15, 2018
It seems like the intent of Ctrl+C as "copy" is to maintain consistent behavior across the Editor and the Terminal areas in VS Code on Windows. Keeping that in mind, are there alternative commands that can be used in the Terminal to send an interrupt (SIGINT) to the running process? Can anyone (maybe Daniel Imms (@Tyriar)) explain how to create a new keyboard shortcut (Edit > Preferences > Keyboard Shortcuts) binding that sends a POSIX-style Ctrl+C to the Terminal while allowing the Windows Ctrl+C to remain "copy"?
RReverser commentedon Dec 21, 2018
For anyone else experiencing this in Powershell, as a workaround you can add the following key handler to your
$PROFILE:This should fix the issue of not clearing a line on Ctrl+C while preserving default behaviour of copying text if it's already selected.
This won't help with the original issue though (Ctrl+C in other contexts), but at least should help with the most common annoyance.
Tyriar commentedon Dec 21, 2018
ConPTY support is landing in the next Insiders build, this uses a new backend for the terminal on WIndows 10 build number 17692+, this is expected to fix many bugs in the terminal on Windows as we're adopting Microsoft's official pty API. For earlier versions winpty will still be used a many bugs will still remain (unless they're fixed in that project).
If you find any issues with conpty please report them to https://github.com/Microsoft/console (the team who own ConPTY) or this repo (if you think it's an integration issue). You can opt out of conpty by adding this setting: