GollyJer
GollyJer

Reputation: 26762

In VS Code, how do you stop code that is running via the Code Runner extension?

I'm running a python flask server locally by clicking the run button in VS Code (provided by the Code Runner extension).

How do I stop the server without closing and restarting VS Code?

Upvotes: 14

Views: 51256

Answers (7)

Ramesh
Ramesh

Reputation: 11

For accepting input, you should enable the setting shown below, otherwise it will show code is running.

Open VS Code Settings UI and type 'code runner'. Scroll down a little bit, find this 'code-runner: run in terminal' and enable it. Then restart VsCode.

enter image description here

Upvotes: 1

Chioma
Chioma

Reputation: 1

If ctrl+alt+m is not working for you, click on the red square symbol beside the symbol for running the code at the upper-right side of the screen, then save and run again.

Upvotes: 0

Jaswanth Talada
Jaswanth Talada

Reputation: 1

see if ctrl+alt+M is not working for me, and if you are using coderunner in your computer then see at the top right side there red color square icon symbolizing coderunner just click on that the code will stop running

Upvotes: -1

RileyManda
RileyManda

Reputation: 2651

Use Ctrl+Alt+M or F1 and then select/type Stop Code Run

Other useful Code Runner Commands you can use can be found here: CodeRunner

Upvotes: -1

Himanshu
Himanshu

Reputation: 1

You can use these methods to solve your problem:

  1. Press Ctr+Alt+M to clear your previous output and then run the code again.

  2. You can go to the bottom left of your VS Code page and click on Settings (a gear icon) and select Settings. Then type "code runner" and select the first option "Clear the previous output." That's it.

Upvotes: 0

asymmetryFan
asymmetryFan

Reputation: 732

Mihai Chelaru has already answered the question, but I just wanted to let everyone know that by changing from Ctrl + Alt + M to e.g. Ctrl + Alt + B, the code run does stop.

Upvotes: 1

Mihai Chelaru
Mihai Chelaru

Reputation: 8262

From the Code Runner extension marketplace page, you have the following options:

To stop the running code:

  • use shortcut Ctrl + Alt + M
  • or press F1 and then select/type Stop Code Run
  • or right click the Output Channel and then click Stop Code Run in context menu

YMMV with the Ctrl + Alt + M shortcut, which does not work for me for some reason.

Upvotes: 33

Related Questions