From 3e19fd311bb8589bea1cce0edd0bf405b011d87b Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Wed, 28 Apr 2021 08:40:22 -0400 Subject: [PATCH] Move debugger locking to new stream api --- tractor/_debug.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/tractor/_debug.py b/tractor/_debug.py index 6040d3f..75e502a 100644 --- a/tractor/_debug.py +++ b/tractor/_debug.py @@ -182,24 +182,22 @@ def _breakpoint(debug_func) -> Awaitable[None]: _debugger_request_cs = cs try: async with get_root() as portal: - with trio.fail_after(.5): - stream = await portal.run( + async with portal.open_stream_from( tractor._debug._hijack_stdin_relay_to_child, subactor_uid=actor.uid, - ) - async with aclosing(stream): + ) as stream: - # block until first yield above - async for val in stream: + # block until first yield above + async for val in stream: - assert val == 'Locked' - task_status.started() + assert val == 'Locked' + task_status.started() - # with trio.CancelScope(shield=True): - await do_unlock.wait() + # with trio.CancelScope(shield=True): + await do_unlock.wait() - # trigger cancellation of remote stream - break + # trigger cancellation of remote stream + break finally: log.debug(f"Exiting debugger for actor {actor}") global _in_debug