(self)
| 255 | return await waiter |
| 256 | |
| 257 | def _try_finish(self): |
| 258 | assert not self._finished |
| 259 | if self._returncode is None: |
| 260 | return |
| 261 | if not self._pipes_connected: |
| 262 | # self._pipes_connected can be False if not all pipes were connected |
| 263 | # because either the process failed to start or the self._connect_pipes task |
| 264 | # got cancelled. In this broken state we consider all pipes disconnected and |
| 265 | # to avoid hanging forever in self._wait as otherwise _exit_waiters |
| 266 | # would never be woken up, we wake them up here. |
| 267 | for waiter in self._exit_waiters: |
| 268 | if not waiter.done(): |
| 269 | waiter.set_result(self._returncode) |
| 270 | if all(p is not None and p.disconnected |
| 271 | for p in self._pipes.values()): |
| 272 | self._finished = True |
| 273 | self._call(self._call_connection_lost, None) |
| 274 | |
| 275 | def _call_connection_lost(self, exc): |
| 276 | try: |
no test coverage detected