From 202ef63d6731075444963340f64a08e6df69f552 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 11 Apr 2022 17:09:14 -0400 Subject: [PATCH] Always call pdb hook even if tty locking fails --- tractor/_debug.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tractor/_debug.py b/tractor/_debug.py index cd6bd6138..a111be428 100644 --- a/tractor/_debug.py +++ b/tractor/_debug.py @@ -471,11 +471,15 @@ def child_release_hook(): # we have to figure out how to avoid having the service nursery # cancel on this task start? I *think* this works below? # actor._service_n.cancel_scope.shield = shield - with trio.CancelScope(shield=True): - await actor._service_n.start( - wait_for_parent_stdin_hijack, - actor.uid, - ) + try: + with trio.CancelScope(shield=True): + await actor._service_n.start( + wait_for_parent_stdin_hijack, + actor.uid, + ) + except RuntimeError: + child_release_hook() + raise elif is_root_process():