| 973 | self.timeline.wait_until_realized(timeline.Mark("disconnect"), freeze=True) |
| 974 | |
| 975 | def wait_for_exit(self): |
| 976 | if self.debuggee is not None: |
| 977 | log.info("Waiting for {0} to exit ...", self.debuggee_id) |
| 978 | try: |
| 979 | self.debuggee.wait() |
| 980 | except Exception: |
| 981 | pass |
| 982 | finally: |
| 983 | watchdog.unregister_spawn(self.debuggee.pid, self.debuggee_id) |
| 984 | |
| 985 | self.wait_for_terminated() |
| 986 | |
| 987 | # FIXME: "exited" event is not properly reported in attach scenarios at the |
| 988 | # moment, so the exit code is only checked if it's present. |
| 989 | if self.debuggee is not None and self.exit_code is not None: |
| 990 | assert self.debuggee.returncode == self.exit_code |
| 991 | return self.exit_code |
| 992 | |
| 993 | def wait_for_terminated(self): |
| 994 | self.timeline.wait_until_realized(timeline.Event("terminated")) |