Open the Link approval URL in the browser for interactive runs

This commit is contained in:
Alex Schapiro 2026-09-01 19:27:51 +00:00
parent e816900cb2
commit 2f8194c829

View file

@ -9,6 +9,8 @@ import shutil
import subprocess
import sys
import tempfile
import webbrowser
from contextlib import suppress
from dataclasses import dataclass
from pathlib import Path
from typing import TYPE_CHECKING, Any, cast
@ -391,6 +393,9 @@ def _run_link_wallet_flow(
if not quiet:
console.print(f"[yellow]Approve the payment in the Link app:[/] {approval_url}")
if sys.stdin.isatty() and sys.stdout.isatty() and approval_url.startswith("https://"):
with suppress(Exception):
webbrowser.open(approval_url)
polled = run_step(
[
"spend-request",