How to disconnect from all debug sessions?

后端 未结 2 519
日久生厌
日久生厌 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条回答
  •  遇见更好的自我
    2021-02-13 19:20

    I ran into this issue when using PyCharm for the first time. I assumed incorrectly that each time I ran the debugger, I was killing any existing run and starting a new one. I found no apparent way in the GUI to kill all of the python processes with open debugger connections, so I just did it in the terminal as follows:

    1. Find the processes you're debugging. In my case, I had over 100 processes before I realized what was going on. Just eyeball it to ensure correctness.

      ps ux | grep my_script_name | grep -v grep
      
    2. Send your list of PIDs to kill (assuming PID is column 2 in your ps output):

      kill -9 `ps ux | grep my_script_name | grep -v grep | awk '{print $2}'`
      
    3. Try closing the tabs in PyCharm. Debugger connections are closed, so it won't complain.

提交回复
热议问题