code: def _run_cmd(cmd: str, should_fail=False) -> Tuple[str, str]:
      """Convenience wrapper for subprocess.run.
  
      We always run with shell=True to simulate the CLI.
  
      Asserts that the process succeeds/fails depending on should_fail.
  
      Returns (stdout, stderr).
      """
      print(f"Running command: '{cmd}'")
      p: subprocess.CompletedProcess = subprocess.run(
          cmd,
          shell=True,
          stdout=subprocess.PIPE,
          stderr=subprocess.PIPE,
      )
      if p.returncode == 0:
          print("Command succeeded.")
          if should_fail:
              raise RuntimeError(
                  f"Expected command to fail, but got exit code: {p.returncode}."
              )
      else:
          print(f"Command failed with exit code: {p.returncode}.")
          if not should_fail:
              raise RuntimeError(
                  f"Expected command to succeed, but got exit code: {p.returncode}."
              )
  
      return p.stdout.decode("utf-8"), p.stderr.decode("utf-8")
  
imports: from contextlib import contextmanager
  import ray
  import json
  import os
  import logging
  import sys
  import subprocess
  from typing import Optional, Tuple
  import pytest
label_desc: Use image node_id 5 for calling a global function with example usage: _run_cmd(cmd, should_fail) and returns: p,  p