Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disconnect from all debug sessions?

Tags:

pycharm

During development I often end up with multiple live sessions. PyCharm gives me an option to close all debugger tabs (or all other tabs), but for each live session it brings up this dialog and I have to click on each one to disconnect. Is there a way to make PyCharm automatically disconnect and terminate all processes?

enter image description here

like image 752
Pyramid Newbie Avatar asked Feb 04 '14 19:02

Pyramid Newbie


People also ask

How do I terminate debugging?

Click Stop Debugging on the Debug menu to stop the target's execution and end the target process and all its threads. This action enables you to start to debug a different target application. )

Why might you create multiple debug configuration for the same project?

If you are working in a team, you might want to share your run/debug configurations so that your teammates could run the application using the same configuration or enable them to remotely attach to the process you are running.


1 Answers

Maybe the best answer to the question is to not start all these sessions in the first place. If what you really want to do is kill the existing session when you start the debugger, set the "Single instance only" option in the Run/Debug Configurations dialog.

enter image description here

Then each time you click the debug icon (or Shift+F9) it will stop the current session and start a new one. Before I figured out what this did, I would end up with a number of sessions still running even though I was no longer interested in them.

The PyCharm help says the following, but in my experience, with this checked, restarting the debugger just kills off the current instance and starts a new one. This is useful when you don't want a bunch of old instances running, but it is critical when building a Django app and you don't want multiple instances trying to run at the same time.

If this check box is selected, this run/debug configuration cannot be launched more
than once.

Every time a new run/debug configuration is launched, PyCharm checks the presence of 
the other instances of the same run/debug configuration, and displays a confirmation
dialog box. If you click OK in the confirmation dialog box, the first instance of
the runner will be stopped, and the next one will take its place.

This make sense, when usage of certain resources can cause conflicts, or when
launching two run/debug configurations of the same type consumes too much of the CPU
and memory resources. If this check box is not selected, it is possible to launch as
many instances of the runner as required. So doing, each runner will start in its own
tab of the Run tool window.
like image 108
andrewmo Avatar answered Nov 12 '22 04:11

andrewmo