INNER CODE UNIT · Python

run_claude_with_spinner

panther-labs/panther-analysis · .scripts/claude_review.py:187

def run_claude_with_spinner(cmd, prompt, spinner_msg="Working..."):
    """Run a Claude command with a spinner. Returns (stdout, stderr, success)."""
    with tempfile.NamedTemporaryFile(mode="w", suffix=".txt", delete=False) as f:
        f.write(prompt)
        prompt_file = f.name

    stop_spinner = threading.Event()

    def spinner():
        chars = "\u280b\u2819\u2839\u2838\u283c\u2834\u2826\u2827\u2807\u280f"
        i = 0
        while not stop_spinner.is_set():
            eprint(f"\r   {chars[i % len(chars)]} {spinner_msg}", end="", flush=True)
            i += 1
            time.sleep(0.1)
        eprint("\r" + " " * (len(spinner_msg) + 10) + "\r", end="")

    spin_thread = threading.Thread(target=spinner, daemon=True)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…