Skip to content

Commit e5c3234

Browse files
authored
Merge pull request #44 from jkawamoto/subprocess
2 parents cb90040 + 83db5f8 commit e5c3234

File tree

2 files changed

+141
-97
lines changed

2 files changed

+141
-97
lines changed

src/mcp_bear/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import json
1111
import logging
1212
import os
13-
import webbrowser
1413
from asyncio import Future
1514
from contextlib import asynccontextmanager
1615
from copy import deepcopy
@@ -154,7 +153,15 @@ async def _request(
154153
future = Future[QueryParams]()
155154
ctx.request_context.lifespan_context.futures[req_id] = future
156155
try:
157-
webbrowser.open(f"{BASE_URL}/{path}?{urlencode(params, quote_via=quote)}")
156+
proc = await asyncio.create_subprocess_exec(
157+
"open",
158+
"-g",
159+
"-j",
160+
f"{BASE_URL}/{path}?{urlencode(params, quote_via=quote)}",
161+
)
162+
returncode = await proc.wait()
163+
if returncode != 0:
164+
raise RuntimeError(f"failed to open Bear (exit code: {returncode}).")
158165
return await future
159166

160167
finally:

0 commit comments

Comments
 (0)