class_docstr: Subprocess communication protocol base class for `run_async_cmd`
  
  This class implements basic subprocess output handling. Derived classes
  like `StdOutCapture` should be used for subprocess communication that need
  to capture and return output. In particular, the `pipe_data_received()`
  method can be overwritten to implement "online" processing of process
  output.
  
  This class defines a default return value setup that causes
  `run_async_cmd()` to return a 2-tuple with the subprocess's exit code
  and a list with bytestrings of all captured output streams.
docstr: Parameters
  ----------
  done_future: Any
    Ignored parameter, kept for backward compatibility (DEPRECATED)
  encoding : str
    Encoding to be used for process output bytes decoding. By default,
    the preferred system encoding is guessed.
docstr_tok: ["Parameters","--","--","--","--","--","done_future",":","Any","Ignored","parameter",",","kept","for","backward","compatibility","(","DEPRECATED",")","encoding",":","str","Encoding","to","be","used","for","process","output","bytes","decoding",".","By","default",",","the","preferred","system","encoding","is","guessed","."]
code: def __init__(
      self, done_future: Any = None, encoding: Optional[str] = None
  ) -> None:
      """
      Parameters
      ----------
      done_future: Any
        Ignored parameter, kept for backward compatibility (DEPRECATED)
      encoding : str
        Encoding to be used for process output bytes decoding. By default,
        the preferred system encoding is guessed.
      """
  
      if done_future is not None:
          warnings.warn(
              "`done_future` argument is ignored "
              "and will be removed in a future release",
              DeprecationWarning,
          )
  
      self.fd_infos: dict[int, tuple[str, Optional[bytearray]]] = {}
  
      self.process: Optional[subprocess.Popen] = None
      self.stdout_fileno = 1
      self.stderr_fileno = 2
  
      # capture output in bytearrays while the process is running
      self.fd_infos[self.stdout_fileno] = (
          ("stdout", bytearray()) if self.proc_out else ("stdout", None)
      )
      self.fd_infos[self.stderr_fileno] = (
          ("stderr", bytearray()) if self.proc_err else ("stderr", None)
      )
  
      super().__init__()
      self.encoding = encoding or getpreferredencoding(
          do_setlocale=False
      )
  
      self._log_outputs = False
      if lgr.isEnabledFor(5):
          try:
              from datalad import cfg
  
              self._log_outputs = cfg.getbool(
                  "datalad.log", "outputs", default=False
              )
          except ImportError:
              pass
          self._log = self._log_summary
      else:
          self._log = self._log_nolog
  
imports: from __future__ import annotations
  import logging
  import subprocess
  import warnings
  from collections import deque
  from locale import getpreferredencoding
  from typing import Any, Optional
  from datalad.utils import ensure_unicode
  from .exception import CommandError
label_desc: Use image node_id 1 to create a new WitlessProtocol object  with example: obj = WitlessProtocol(done_future, encoding)