Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Terminal - Windows] Ctrl+c doesn't work #28635

Closed
warpdesign opened this issue Jun 13, 2017 · 13 comments
Closed

[Terminal - Windows] Ctrl+c doesn't work #28635

warpdesign opened this issue Jun 13, 2017 · 13 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug terminal Integrated terminal issues upstream Issue identified as 'upstream' component related (exists outside of VS Code) verified Verification succeeded
Milestone

Comments

@warpdesign
Copy link
Contributor

  • VSCode Version: Insiders bbcd10...
  • OS Version: Windows 10 (Insiders)

Steps to Reproduce:

  1. Open a new integrated terminal
  2. Type "node" to run nodejs
  3. Type ctrl + c (several times)

What happens?
Nothing

What should happen?
The first time ctrl + c is pressed, nodejs should print out (To exit, press ^C again or type .exit) and the second time it is pressed, it should exit nodejs.

Note that it works fine with a standard (external) cmd prompt.

Here is my settings.json file:

// Place your settings in this file to overwrite the default settings
{
    "terminal.integrated.cursorBlinking": true,
    "terminal.integrated.lineHeight": 1.3,
    "workbench.editor.enablePreview": false,
    "workbench.editor.enablePreviewFromQuickOpen": false,
    "window.openFilesInNewWindow": false,
    "window.reopenFolders": "one",
    "typescript.check.tscVersion": false,
    "workbench.sideBar.location": "left",
    "window.zoomLevel": 0,
    "workbench.activityBar.visible": true,
    "terminal.integrated.shell.windows": "C:\\WINDOWS\\Sysnative\\cmd.exe",
    "terminal.integrated.rightClickCopyPaste": true,
    "terminal.integrated.cursorStyle": "line",
    "terminal.integrated.fontLigatures": true,
    "terminal.integrated.fontFamily": "Consolas",
    "workbench.quickOpen.closeOnFocusLost": true,
    "workbench.iconTheme": "vscode-great-icons",
    "hexdump.width": 32,
    "window.menuBarVisibility": "toggle",
    "workbench.colorTheme": "Dracula",
    "editor.formatOnPaste": true
}
@vscodebot vscodebot bot added the insiders label Jun 13, 2017
@warpdesign warpdesign changed the title [Terminal - Windows] Ctrl-c not caught [Terminal - Windows] Ctrl+c doesn't work Jun 13, 2017
@ramya-rao-a ramya-rao-a added the terminal Integrated terminal issues label Jun 13, 2017
@Tyriar
Copy link
Member

Tyriar commented Jun 13, 2017

This has been a long standing issue I believe related to winpty. Currently tracked upstream in microsoft/node-pty#7

@rprichard could this have something to do with the processes not dying when ctrl+c is pressed, similar to #26807?

@Tyriar Tyriar added bug Issue identified by VS Code Team member as probable bug upstream Issue identified as 'upstream' component related (exists outside of VS Code) and removed insiders labels Jun 13, 2017
@Tyriar Tyriar added this to the Backlog milestone Jun 13, 2017
@rprichard
Copy link

@rprichard could this have something to do with the processes not dying when ctrl+c is pressed, similar to 26807?

No, those two issues aren't likely to be related.

It could be related to this upstream winpty issue, rprichard/winpty#116. For now, I'm considering it a limitation. The master branch in winpty has a change that improved Ctrl-C handling in new versions of PowerShell (e.g. Windows 10, not Windows 7). Maybe it'd also improve node.js?

However, I just tested winpty+node, and it worked fine, even with old versions of winpty. When I hit Ctrl-C, I see the message prompting me to hit Ctrl-C again, and when I do, it exits. It also worked fine in VS Code. I'm using Win 10.0.15063.332 (Creators Update) and node v6.10.3. I first tested in Cygwin64's mintty running winpty 0.4.2, 0.4.3, and master. I then tested with VS Code 1.12.2. VSCode updated itself to 1.13.0 today, and that also worked fine. My VSCode's terminal.integrated.shell.windows setting is unset, so VSCode initially runs PowerShell under winpty.

Here's what I see in VSCode when I type: 1 + 2 Enter Ctrl-C Ctrl-C.

C:\Users\rprichard>node.exe
> 1 + 2
3
>
(To exit, press ^C again or type .exit)
>

C:\Users\rprichard>

Maybe report your node --version.

@rprichard
Copy link

I installed node 8.1.0, and it also worked fine. In Cygwin64's mintty:

rprichard@duck15063 ~/proj/winpty
$ build/winpty --version
winpty version 0.4.4-dev
commit ce9239af5d751195ea6982a41c7d71356ac9201c

rprichard@duck15063 ~/proj/winpty
$ /c/Program\ Files/nodejs-8.1.0-x64/node.exe --version
v8.1.0

rprichard@duck15063 ~/proj/winpty
$ build/winpty /c/Program\ Files/nodejs-8.1.0-x64/node.exe
> 1 + 2
3
>
(To exit, press ^C again or type .exit)
>

rprichard@duck15063 ~/proj/winpty

It also worked fine in VSCode.

@warpdesign
Copy link
Contributor Author

warpdesign commented Jun 13, 2017

I am using node 7.0.0, and the standard cmd.exe (no powershell or bash but I have the same problem from vscode/bash).

I also have the same problem if I unset the terminal.integrated.shell.windows setting.

Edit: just to be sure, I updated to node 8.1.0 and am getting the same problem.

@Tyriar
Copy link
Member

Tyriar commented Jun 13, 2017

@rprichard it seems to happen about 50% of the time to me..

@jpmckearin
Copy link

Could it be that this is fixed with the Creator's Update? I am on Anniversary Update and have this problem.

@warpdesign
Copy link
Contributor Author

warpdesign commented Jun 15, 2017

@Tyriar Something interesting: I downloaded VSCode 1.13.1 (public stable build) and ctrl+c works as expected.

@eamodio
Copy link
Contributor

eamodio commented Jun 20, 2017

Is there a workaround for now to kill a running task in the terminal (without killing the whole terminal)?

FWIW, I am also only having the issue in the insiders build -- in 1.13.1 ctrl+c works for me.

@Tyriar
Copy link
Member

Tyriar commented Jun 20, 2017

@eamodio I'm not aware of a workaround.

@tonoslav
Copy link

Solution for my problem:

  • in User settings
  • edit setting terminal.integrated.commandsToSkipShell
  • remove workbench.action.terminal.copySelection from array

now terminating of batch job in terminal works via CTRL + C for me

@Tyriar
Copy link
Member

Tyriar commented Jun 21, 2017

@tonoslav bingo, you found the bug! I actually fixed this yesterday in Insiders 😄, here's the root cause: xtermjs/xterm.js#724

@Tyriar Tyriar closed this as completed Jun 21, 2017
@Tyriar Tyriar modified the milestones: June 2017, Backlog Jun 21, 2017
@weinand weinand added the verified Verification succeeded label Jun 28, 2017
@mikemaccana
Copy link

mikemaccana commented Jul 13, 2017

Hrm "workbench.action.terminal.copySelection" is in DEFAULT SETTINGS but not in USER SETTINGS. How can I disable the default setting?

@Tyriar
Copy link
Member

Tyriar commented Jul 13, 2017

@mikemaccana I doubt you're experiencing this issue. Also workbench.action.terminal.copySelection is a command (keybinding), not a setting.

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug terminal Integrated terminal issues upstream Issue identified as 'upstream' component related (exists outside of VS Code) verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

9 participants