INNER CODE UNIT · Python

_claude_status_logged_in

ghost-in-the-droid/android-agent · gitd/cli.py:704

def _claude_status_logged_in(timeout: int = 10) -> bool:
    """Ask the claude CLI whether it's signed in, via `claude auth status`.

    Storage-agnostic — respects wherever the CLI keeps creds (plain file on
    Linux, the login Keychain on macOS), so it fixes the false-negative when the
    file check misses on a Mac. Still NEVER reads the token itself; we only look
    at the CLI's own yes/no. Best-effort: any failure → treat as not-signed-in.
    """
    try:
        r = subprocess.run(
            ["claude", "auth", "status"],
            capture_output=True,
            text=True,
            timeout=timeout,
        )
    except Exception:
        return False
    out = (r.stdout or "").strip()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…