forked from goodboy/tractor
1
0
Fork 0

Re-raise KBI's i guess?

zombie_lord_infinite
Tyler Goodlet 2021-10-08 21:01:51 -04:00
parent 5df08aabb7
commit 5048c3534f
1 changed files with 5 additions and 3 deletions

View File

@ -282,6 +282,7 @@ async def _open_and_supervise_one_cancels_all_nursery(
# after daemon nursery exit # after daemon nursery exit
finally: finally:
log.cancel(f'Waiting on remaining children {anursery._children}')
with trio.CancelScope(shield=True): with trio.CancelScope(shield=True):
await anursery._all_children_reaped.wait() await anursery._all_children_reaped.wait()
# No errors were raised while awaiting ".run_in_actor()" # No errors were raised while awaiting ".run_in_actor()"
@ -302,11 +303,12 @@ async def _open_and_supervise_one_cancels_all_nursery(
else: else:
raise list(errors.values())[0] raise list(errors.values())[0]
elif original_err:
raise original_err
log.cancel(f'{anursery} terminated gracefully') log.cancel(f'{anursery} terminated gracefully')
# XXX" honestly no idea why this is needed but sure..
if isinstance(original_err, KeyboardInterrupt) and anursery.cancelled:
raise original_err
@asynccontextmanager @asynccontextmanager
async def open_nursery( async def open_nursery(