(
self,
buffer_: List[str],
hide: bool,
output: IO,
reader: Callable,
)
| 748 | stream.flush() |
| 749 | |
| 750 | def _handle_output( |
| 751 | self, |
| 752 | buffer_: List[str], |
| 753 | hide: bool, |
| 754 | output: IO, |
| 755 | reader: Callable, |
| 756 | ) -> None: |
| 757 | # TODO: store un-decoded/raw bytes somewhere as well... |
| 758 | for data in self.read_proc_output(reader): |
| 759 | # Echo to local stdout if necessary |
| 760 | # TODO: should we rephrase this as "if you want to hide, give me a |
| 761 | # dummy output stream, e.g. something like /dev/null"? Otherwise, a |
| 762 | # combo of 'hide=stdout' + 'here is an explicit out_stream' means |
| 763 | # out_stream is never written to, and that seems...odd. |
| 764 | if not hide: |
| 765 | self.write_our_output(stream=output, string=data) |
| 766 | # Store in shared buffer so main thread can do things with the |
| 767 | # result after execution completes. |
| 768 | # NOTE: this is threadsafe insofar as no reading occurs until after |
| 769 | # the thread is join()'d. |
| 770 | buffer_.append(data) |
| 771 | # Run our specific buffer through the autoresponder framework |
| 772 | self.respond(buffer_) |
| 773 | |
| 774 | def handle_stdout( |
| 775 | self, buffer_: List[str], hide: bool, output: IO |
no test coverage detected