Wait for child process to terminate; returns self.returncode.
(self, timeout=None)
| 1257 | |
| 1258 | |
| 1259 | def wait(self, timeout=None): |
| 1260 | """Wait for child process to terminate; returns self.returncode.""" |
| 1261 | if timeout is not None: |
| 1262 | endtime = _time() + timeout |
| 1263 | try: |
| 1264 | return self._wait(timeout=timeout) |
| 1265 | except KeyboardInterrupt: |
| 1266 | # https://bugs.python.org/issue25942 |
| 1267 | # The first keyboard interrupt waits briefly for the child to |
| 1268 | # exit under the common assumption that it also received the ^C |
| 1269 | # generated SIGINT and will exit rapidly. |
| 1270 | if timeout is not None: |
| 1271 | sigint_timeout = min(self._sigint_wait_secs, |
| 1272 | self._remaining_time(endtime)) |
| 1273 | else: |
| 1274 | sigint_timeout = self._sigint_wait_secs |
| 1275 | self._sigint_wait_secs = 0 # nothing else should wait. |
| 1276 | try: |
| 1277 | self._wait(timeout=sigint_timeout) |
| 1278 | except TimeoutExpired: |
| 1279 | pass |
| 1280 | raise # resume the KeyboardInterrupt |
| 1281 | |
| 1282 | def _close_pipe_fds(self, |
| 1283 | p2cread, p2cwrite, |
no test coverage detected