Gracefully handle missing 'terminated' and 'exited' events on ptvsd exit regardless of Python version - also happens on 2.x sometimes.

This commit is contained in:
Pavel Minaev 2018-10-10 23:02:28 -07:00 committed by Karthik Nadig
parent 75fc537656
commit c0cb53227e

View file

@ -196,10 +196,9 @@ class DebugSession(object):
def wait_for_termination(self, expected_returncode=0):
print(colors.LIGHT_MAGENTA + 'Waiting for ptvsd#%d to terminate' % self.ptvsd_port + colors.RESET)
if sys.version_info < (3,):
# On 3.x, ptvsd sometimes exits without sending this, likely due to
# https://github.com/Microsoft/ptvsd/issues/530
self.wait_for_next(Event('terminated'))
# BUG: ptvsd sometimes exits without sending 'terminate' or 'exited', likely due to
# https://github.com/Microsoft/ptvsd/issues/530. So rather than wait for them, wait until
# we disconnect, then check those events for proper body only if they're actually present.
self.wait_for_disconnect(close=False)