code: def _communicate_commanderror(exc):
      """Behave as if the command ran directly"""
      exc_msg = exc.to_str(include_output=False)
      if exc_msg:
          msg = (
              exc_msg.encode() if isinstance(exc_msg, str) else exc_msg
          )
          os.write(2, msg + b"\n")
      # push any captured output to the respective streams
      for out, stream in ((exc.stdout, 1), (exc.stderr, 2)):
          if out:
              os.write(
                  stream, out.encode() if isinstance(out, str) else out
              )
      # pass on exit code
      return exc.code
  
file_path: datalad/datalad/cli/main.py
imports: import logging
  import os
  import sys
  import datalad
  from .parser import setup_parser
label_desc: Use image node_id 6 for calling a global function with example usage: _communicate_commanderror(exc) and returns: exc