Wait for the process to finish.
(self)
| 564 | self._proc.terminate() |
| 565 | |
| 566 | def wait(self) -> None: |
| 567 | """Wait for the process to finish.""" |
| 568 | if self._out_thread.is_alive(): |
| 569 | self._out_thread.join() |
| 570 | if self._err_thread.is_alive(): |
| 571 | self._err_thread.join() |
| 572 | |
| 573 | # Handle case where the process ended before the last read could be done. |
| 574 | # This will return None for the streams that weren't pipes. |
| 575 | out, err = self._proc.communicate() |
| 576 | |
| 577 | if out: |
| 578 | self._write_bytes(self._stdout, out) |
| 579 | if err: |
| 580 | self._write_bytes(self._stderr, err) |
| 581 | |
| 582 | def _reader_thread_func(self, read_stdout: bool) -> None: |
| 583 | """Thread function that reads a stream from the process. |