| 943 | self._capture.start_capturing() |
| 944 | |
| 945 | def close(self) -> None: |
| 946 | if self._capture is not None: |
| 947 | if self._config.get(class="st">"tee"): |
| 948 | class="cm"># When tee is enabled, output was already written to the |
| 949 | class="cm"># original stream in real-time by TeeCaptureIO. Using |
| 950 | class="cm"># pop_outerr_to_orig() would write it a second time via |
| 951 | class="cm"># writeorg(), causing doubled output (see #13784). |
| 952 | out, err = self._capture.readouterr() |
| 953 | else: |
| 954 | out, err = self._capture.pop_outerr_to_orig() |
| 955 | self._captured_out += out |
| 956 | self._captured_err += err |
| 957 | self._capture.stop_capturing() |
| 958 | self._capture = None |
| 959 | |
| 960 | def readouterr(self) -> CaptureResult[AnyStr]: |
| 961 | class="st">"""Read and return the captured output so far, resetting the internal |