11

I am using the VSCode 1.38.0 on macOS 10.14.6 and running into this problem here:

  1. Open a terminal application in the integrated terminal
  2. Press Ctrl-C with the focus inside the terminal, while the application is running
  3. The terminal does not get a signal to stop the process; instead I can see that it is triggers Mac's copy command (which is normally cmd+c)

I tested this by removing all extensions and resetting all mapped keys, but still get this same issue.

My problem is very similar to this issue linked below, reported by another user, except that I am running a newer version of VSCode on macOS.

https://github.com/Microsoft/vscode/issues/29773

krmsrc
  • 111
  • 1
  • 1
  • 3

6 Answers6

22

I solved the problem by using command + .

You can also use: control^ + c

Usoof
  • 650
  • 1
  • 5
  • 19
8

On macOS Catalina, CTRL+Z works for me.

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
MILITARY FOX
  • 105
  • 1
  • 3
  • 7
    This will suspend the process and put it in the background. It will return control of the prompt to the user, but the process is still running. You would then need to note the process id and issue a kill command to completely stop the process. (i.e. `kill `) Alternatively, you can issue the `fg` command to resume the process in the foreground. – Neil Monroe Oct 21 '20 at 01:24
2

Not sure if you are still hitting this issue with more recent versions, but for others getting here, you could try a manual keybinding to send the control sequence to the terminal as described in this answer. I changed it to just "ctrl+c" and it works for me, with "Allow Chords" enabled for the Terminal settings and making sure I have no other chords that start with "ctrl+c" since that would intercept the sequence.

  {
    "key": "ctrl+c",
    "command": "workbench.action.terminal.sendSequence",
    "args": {
      "text": "\u0003"
    },
    "when": "terminalFocus"
  }
Pang
  • 9,564
  • 146
  • 81
  • 122
totalhack
  • 2,298
  • 17
  • 23
2

With vscode v1.60 you should be able to use Cmd+. to kill the process (same as Cmd+C).

See Add terminal keybinding for cmd+. -> ctrl+c to match Terminal.app

Mark
  • 143,421
  • 24
  • 428
  • 436
1

If you are using a MAC, and if you are using an External Keyboard and have reverted settings for Ctrl and Command button, then Command+. should be equivalent to Ctrl+C for break in terminal.

Shivam Anand
  • 952
  • 1
  • 10
  • 21
0

Sometimes this can be buggy, but Ctrl-Alt-M (Ctrl-Option-M on a mac) will stop the current batch job when running things like a node Server.

For testing purposes you could write a peice of code that never finishes (like a for loop that won't terminate) and try "ctrl-c" and "ctrl-opt-m" and see what happens. If the problem persists, I would restart the computer and/or make sure Visual Studio and your OS are up to date.

Referenced from this thread: how to stop a command in the VS Code terminal

2EricH
  • 42
  • 8