class_docstr: Container for a running subprocess. Supports communication with the
  subprocess via stdin and stdout.
class_docstr_tok: ["Container","for","a","running","subprocess",".","Supports","communication","with","the","subprocess","via","stdin","and","stdout","."]
code: def __init__(
      self,
      cmd: Union[str, Tuple, List],
      path: Optional[str] = None,
      output_proc: Optional[Callable] = None,
      timeout: Optional[float] = None,
      exception_on_timeout: bool = False,
  ):
      command = cmd
      self.command: list = (
          [command] if not isinstance(command, List) else command
      )
      self.path: Optional[str] = path
      self.output_proc: Optional[Callable] = output_proc
      self.timeout: Optional[float] = timeout
      self.exception_on_timeout: bool = exception_on_timeout
  
      self.stderr_output = b""
      self.runner: Optional[WitlessRunner] = None
      self.encoding = None
      self.wait_timed_out = None
      self.return_code: Optional[int] = None
      self._abandon_cache = None
      self.last_request: Optional[str] = None
  
      self._active = 0
      self._active_last = _now()
      self.clean_inactive()
      assert id(self) not in self._active_instances
      self._active_instances[id(self)] = self
  
      # pure declarations
      self.stdin_queue: Queue
      self.generator: _ResultGenerator
  
imports: from __future__ import annotations
  import logging
  import os
  import queue
  import sys
  import warnings
  from datetime import datetime
  from operator import attrgetter
  from queue import Queue
  from subprocess import TimeoutExpired
  from typing import Any, Callable, List, Optional, Tuple, Union
  from weakref import ReferenceType, WeakValueDictionary, ref
  from datalad import cfg
  from datalad.runner.coreprotocols import KillOutput, NoCapture, StdErrCapture, StdOutCapture, StdOutErrCapture
  from datalad.runner.gitrunner import GIT_SSH_COMMAND, GitRunnerBase, GitWitlessRunner
  from datalad.runner.nonasyncrunner import STDERR_FILENO, STDOUT_FILENO, _ResultGenerator, run_command
  from datalad.runner.protocol import GeneratorMixIn, WitlessProtocol
  from datalad.runner.runner import WitlessRunner
  from datalad.runner.utils import LineSplitter
  from datalad.support.exceptions import CommandError
  from datalad.utils import auto_repr, ensure_unicode
label_desc: Use image node_id 1 to create a new BatchedCommand object from inherited base classes: SafeDelCloseMixin with example: obj = BatchedCommand(cmd, path, output_proc, timeout, exception_on_timeout)