| 256 | # PyDBCommandThread |
| 257 | # ======================================================================================================================= |
| 258 | class PyDBCommandThread(PyDBDaemonThread): |
| 259 | def __init__(self, py_db): |
| 260 | PyDBDaemonThread.__init__(self, py_db) |
| 261 | self._py_db_command_thread_event = py_db._py_db_command_thread_event |
| 262 | self.name = "pydevd.CommandThread" |
| 263 | |
| 264 | @overrides(PyDBDaemonThread._on_run) |
| 265 | def _on_run(self): |
| 266 | # Delay a bit this initialization to wait for the main program to start. |
| 267 | self._py_db_command_thread_event.wait(TIMEOUT_SLOW) |
| 268 | |
| 269 | if self._kill_received: |
| 270 | return |
| 271 | |
| 272 | try: |
| 273 | while not self._kill_received: |
| 274 | try: |
| 275 | self.py_db.process_internal_commands(("*",)) |
| 276 | except: |
| 277 | pydev_log.info("Finishing debug communication...(2)") |
| 278 | self._py_db_command_thread_event.clear() |
| 279 | self._py_db_command_thread_event.wait(TIMEOUT_SLOW) |
| 280 | except: |
| 281 | try: |
| 282 | pydev_log.debug(sys.exc_info()[0]) |
| 283 | except: |
| 284 | # In interpreter shutdown many things can go wrong (any module variables may |
| 285 | # be None, streams can be closed, etc). |
| 286 | pass |
| 287 | |
| 288 | # only got this error in interpreter shutdown |
| 289 | # pydev_log.info('Finishing debug communication...(3)') |
| 290 | |
| 291 | @overrides(PyDBDaemonThread.do_kill_pydev_thread) |
| 292 | def do_kill_pydev_thread(self): |
| 293 | PyDBDaemonThread.do_kill_pydev_thread(self) |
| 294 | # Set flag so that it can exit before the usual timeout. |
| 295 | self._py_db_command_thread_event.set() |
| 296 | |
| 297 | |
| 298 | # ======================================================================================================================= |
no outgoing calls
no test coverage detected