14

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

How do I stop the server without closing and restarting VSCode?

Gama11
  • 31,714
  • 9
  • 78
  • 100
GollyJer
  • 23,857
  • 16
  • 106
  • 174

5 Answers5

33

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.

Mihai Chelaru
  • 7,614
  • 14
  • 45
  • 51
  • Works perfectly. But I am using code runner for dart, When i run the code in terminal it uses the entire path of the file, while the terminal is already opened in the project directory. This is causing the process to be slow. Is there a way to just use the path with respect to the project directory? – DaniyalAhmadSE Oct 02 '20 at 10:41
  • That's a good question, and one I don't yet know the answer to. I would suggest that you create a new question and ask it there so that it gets more visibility and has more chance to help others. – Mihai Chelaru Oct 02 '20 at 12:34
1

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.

asymmetryFan
  • 712
  • 1
  • 10
  • 18
1

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

Go to the setting and type 'code runner'

scroll down a little bit, find this 'code-runner: run in terminal' and check this. Restart VsCode.

Check the pictures I attach :)

enter image description here

Ramesh
  • 11
  • 1
0

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.

jps
  • 20,041
  • 15
  • 75
  • 79
0

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

RileyManda
  • 2,536
  • 25
  • 30