def run_command()

in hack/images/migrate_ecr.py [0:0]


def run_command(command):
    """Run a shell command and return the output."""
    result = subprocess.run(command, shell=True, capture_output=True, text=True)
    if result.returncode != 0:
        print(f"Command failed: {command}\nError: {result.stderr}")
        raise Exception(result.stderr)
    return result.stdout.strip()