def _reader_thread_proc(self, timeout):
    """Read until the stream is closed."""
    for data in self.stream.read_until_close(timeout_ms=timeout):
      if self.stdout is not None:
        self.stdout.write(data)