(interpreter)
| 257 | |
| 258 | |
| 259 | def process_exec_queue(interpreter): |
| 260 | init_mpl_in_console(interpreter) |
| 261 | from pydev_ipython.inputhook import get_inputhook |
| 262 | |
| 263 | try: |
| 264 | kill_if_pid_not_alive = int(os.environ.get("PYDEV_ECLIPSE_PID", "-1")) |
| 265 | except: |
| 266 | kill_if_pid_not_alive = -1 |
| 267 | |
| 268 | while 1: |
| 269 | if kill_if_pid_not_alive != -1: |
| 270 | if not pid_exists(kill_if_pid_not_alive): |
| 271 | exit() |
| 272 | |
| 273 | # Running the request may have changed the inputhook in use |
| 274 | inputhook = get_inputhook() |
| 275 | |
| 276 | if _ProcessExecQueueHelper._debug_hook: |
| 277 | _ProcessExecQueueHelper._debug_hook() |
| 278 | |
| 279 | if inputhook: |
| 280 | try: |
| 281 | # Note: it'll block here until return_control returns True. |
| 282 | inputhook() |
| 283 | except: |
| 284 | pydev_log.exception() |
| 285 | try: |
| 286 | try: |
| 287 | code_fragment = interpreter.exec_queue.get(block=True, timeout=1 / 20.0) # 20 calls/second |
| 288 | except _queue.Empty: |
| 289 | continue |
| 290 | |
| 291 | if callable(code_fragment): |
| 292 | # It can be a callable (i.e.: something that must run in the main |
| 293 | # thread can be put in the queue for later execution). |
| 294 | code_fragment() |
| 295 | else: |
| 296 | more = interpreter.add_exec(code_fragment) |
| 297 | except KeyboardInterrupt: |
| 298 | interpreter.buffer = None |
| 299 | continue |
| 300 | except SystemExit: |
| 301 | raise |
| 302 | except: |
| 303 | pydev_log.exception("Error processing queue on pydevconsole.") |
| 304 | exit() |
| 305 | |
| 306 | |
| 307 | if "IPYTHONENABLE" in os.environ: |
no test coverage detected