How to disconnect from all debug sessions?

后端 未结 2 511
日久生厌
日久生厌 2021-02-13 18:41

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

2条回答
  •  -上瘾入骨i
    2021-02-13 19:03

    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.
    

提交回复
热议问题