File tree Expand file tree Collapse file tree 2 files changed +141
-97
lines changed
Expand file tree Collapse file tree 2 files changed +141
-97
lines changed Original file line number Diff line number Diff line change 1010import json
1111import logging
1212import os
13- import webbrowser
1413from asyncio import Future
1514from contextlib import asynccontextmanager
1615from 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 :
You can’t perform that action at this time.
0 commit comments