Wait for child process to terminate; returns self.returncode.
(self, timeout=None)
| 1271 | |
| 1272 | |
| 1273 | def wait(self, timeout=None): |
| 1274 | """Wait for child process to terminate; returns self.returncode.""" |
| 1275 | if timeout is not None: |
| 1276 | endtime = _time() + timeout |
| 1277 | try: |
| 1278 | return self._wait(timeout=timeout) |
| 1279 | except KeyboardInterrupt: |
| 1280 | # https://bugs.python.org/issue25942 |
| 1281 | # The first keyboard interrupt waits briefly for the child to |
| 1282 | # exit under the common assumption that it also received the ^C |
| 1283 | # generated SIGINT and will exit rapidly. |
| 1284 | if timeout is not None: |
| 1285 | sigint_timeout = min(self._sigint_wait_secs, |
| 1286 | self._remaining_time(endtime)) |
| 1287 | else: |
| 1288 | sigint_timeout = self._sigint_wait_secs |
| 1289 | self._sigint_wait_secs = 0 # nothing else should wait. |
| 1290 | try: |
| 1291 | self._wait(timeout=sigint_timeout) |
| 1292 | except TimeoutExpired: |
| 1293 | pass |
| 1294 | raise # resume the KeyboardInterrupt |
| 1295 | |
| 1296 | def _close_pipe_fds(self, |
| 1297 | p2cread, p2cwrite, |
no test coverage detected