INNER CODE UNIT · Python
check_claude_authed
browser-use/bux · agent/box_agent.py:226
async def check_claude_authed() -> bool:
"""Shell out to `claude auth status`; return True iff loggedIn.
Claude prints JSON like `{"loggedIn": true, ...}` on stdout. Substring
match is robust to minor key-order / whitespace formatting changes.
"""
try:
proc = await asyncio.create_subprocess_exec(
CLAUDE_BIN,
'auth',
'status',
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.STDOUT,
env={**os.environ, 'HOME': '/home/bux'},
)
except Exception:
return False
res = await _run_with_timeout(proc, 15)