MCPcopy Create free account
hub / github.com/pyinvoke/invoke / _handle_output

Method _handle_output

invoke/runners.py:750–772  ·  view source on GitHub ↗
(
        self,
        buffer_: List[str],
        hide: bool,
        output: IO,
        reader: Callable,
    )

Source from the content-addressed store, hash-verified

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

Callers 2

handle_stdoutMethod · 0.95
handle_stderrMethod · 0.95

Calls 3

read_proc_outputMethod · 0.95
write_our_outputMethod · 0.95
respondMethod · 0.95

Tested by

no test coverage detected