From f5c725788e2647bb2acf22331d552c589707a3e2 Mon Sep 17 00:00:00 2001 From: Chih Cheng Liang Date: Mon, 11 Nov 2019 22:52:48 +0800 Subject: [PATCH] need manual stop --- examples/chat/chat.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/chat/chat.py b/examples/chat/chat.py index 73436a0d..b1d416ff 100755 --- a/examples/chat/chat.py +++ b/examples/chat/chat.py @@ -79,7 +79,10 @@ async def run(port: int, destination: str, localhost: bool) -> None: async def async_main_wrapper(*args): async with trio_asyncio.open_loop() as loop: assert loop == asyncio.get_event_loop() - await run(*args) + stopped_event = trio.Event() + await trio_asyncio.run_asyncio(run, *args) + await stopped_event.wait() + def main() -> None: description = """