Wait for child process to terminate; returns self.returncode.
(self, timeout=None)
| 1325 | |
| 1326 | |
| 1327 | def wait(self, timeout=None): |
| 1328 | """Wait for child process to terminate; returns self.returncode.""" |
| 1329 | if timeout is not None: |
| 1330 | endtime = _time() + timeout |
| 1331 | try: |
| 1332 | return self._wait(timeout=timeout) |
| 1333 | except KeyboardInterrupt: |
| 1334 | # https://bugs.python.org/issue25942 |
| 1335 | # The first keyboard interrupt waits briefly for the child to |
| 1336 | # exit under the common assumption that it also received the ^C |
| 1337 | # generated SIGINT and will exit rapidly. |
| 1338 | if timeout is not None: |
| 1339 | sigint_timeout = min(self._sigint_wait_secs, |
| 1340 | self._remaining_time(endtime)) |
| 1341 | else: |
| 1342 | sigint_timeout = self._sigint_wait_secs |
| 1343 | self._sigint_wait_secs = 0 # nothing else should wait. |
| 1344 | try: |
| 1345 | self._wait(timeout=sigint_timeout) |
| 1346 | except TimeoutExpired: |
| 1347 | pass |
| 1348 | raise # resume the KeyboardInterrupt |
| 1349 | |
| 1350 | def _close_pipe_fds(self, |
| 1351 | p2cread, p2cwrite, |
no test coverage detected