|
6 | 6 | from rich.console import Console |
7 | 7 |
|
8 | 8 | from basic_memory.cli.app import cloud_app |
| 9 | +from basic_memory.cli.commands.command_utils import run_with_cleanup |
9 | 10 | from basic_memory.cli.auth import CLIAuth |
10 | 11 | from basic_memory.config import ConfigManager |
11 | 12 | from basic_memory.cli.commands.cloud.api_client import ( |
@@ -64,7 +65,7 @@ async def _login(): |
64 | 65 | ) |
65 | 66 | raise typer.Exit(1) |
66 | 67 |
|
67 | | - asyncio.run(_login()) |
| 68 | + run_with_cleanup(_login()) |
68 | 69 |
|
69 | 70 |
|
70 | 71 | @cloud_app.command() |
@@ -110,7 +111,7 @@ def status() -> None: |
110 | 111 | console.print("\n[blue]Checking cloud instance health...[/blue]") |
111 | 112 |
|
112 | 113 | # Make API request to check health |
113 | | - response = asyncio.run( |
| 114 | + response = run_with_cleanup( |
114 | 115 | make_api_request(method="GET", url=f"{host_url}/proxy/health", headers=headers) |
115 | 116 | ) |
116 | 117 |
|
@@ -156,12 +157,12 @@ def setup() -> None: |
156 | 157 |
|
157 | 158 | # Step 2: Get tenant info |
158 | 159 | console.print("\n[blue]Step 2: Getting tenant information...[/blue]") |
159 | | - tenant_info = asyncio.run(get_mount_info()) |
| 160 | + tenant_info = run_with_cleanup(get_mount_info()) |
160 | 161 | console.print(f"[green]Found tenant: {tenant_info.tenant_id}[/green]") |
161 | 162 |
|
162 | 163 | # Step 3: Generate credentials |
163 | 164 | console.print("\n[blue]Step 3: Generating sync credentials...[/blue]") |
164 | | - creds = asyncio.run(generate_mount_credentials(tenant_info.tenant_id)) |
| 165 | + creds = run_with_cleanup(generate_mount_credentials(tenant_info.tenant_id)) |
165 | 166 | console.print("[green]Generated secure credentials[/green]") |
166 | 167 |
|
167 | 168 | # Step 4: Configure rclone remote |
|
0 commit comments