MCPcopy Index your code
hub / github.com/python-cmd2/cmd2 / wait

Method wait

cmd2/utils.py:566–580  ·  view source on GitHub ↗

Wait for the process to finish.

(self)

Source from the content-addressed store, hash-verified

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.

Callers 6

do_shellMethod · 0.95
_redirect_outputMethod · 0.80
_restore_outputMethod · 0.80
_add_alerts_funcMethod · 0.80

Calls 1

_write_bytesMethod · 0.95

Tested by 2