code: def run_process_and_capture_output(cmd, env=None):
      """Runs |cmd| as a child process.
  
      Returns process exit code and output. Streams process output to stdout when
      VERBOSE is true.
  
      Args:
        cmd: String containing the command to execute.
        env: Optional dict of environment variables.
  
      Returns:
        Tuple of exit code and output.
      """
      if not cmd:
          raise ValueError(
              "run_process_and_capture_output requires cmd argument."
          )
  
      if os.name == "posix":
          # On posix systems subprocess.Popen will treat |cmd| as the program name
          # when it is passed as a string. Unconditionally split the command so
          # callers don't need to care about this detail.
          cmd = shlex.split(cmd)
  
      proc = subprocess.Popen(
          cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env
      )
  
      if VERBOSE:
          print("COMMAND output:")
  
      stdout = ""
      for line in iter(proc.stdout.readline, b""):
          decoded_line = line.decode("utf-8")
          if VERBOSE:
              sys.stdout.write(decoded_line)
              sys.stdout.flush()
          stdout += decoded_line
  
      # Wait for the process to exit so that the exit code is available.
      proc.wait()
      return [proc.returncode, stdout]
  
file_path: open-asset-importer/contrib/draco/src/draco/tools/install_test/test.py
imports: import argparse
  import multiprocessing
  import os
  import pathlib
  import shlex
  import shutil
  import subprocess
  import sys
label_desc: Use image node_id 3 for calling a global function with example usage: run_process_and_capture_output(cmd, env) and returns: list