Expose a `_ctlc_ignore_header: str` for use in `sigint_shield()`

aio_abandons
Tyler Goodlet 2024-12-09 16:56:30 -05:00
parent b875b35b98
commit 508ba510a5
1 changed files with 21 additions and 9 deletions

View File

@ -1420,6 +1420,10 @@ def any_connected_locker_child() -> bool:
return False return False
_ctlc_ignore_header: str = (
'Ignoring SIGINT while debug REPL in use'
)
def sigint_shield( def sigint_shield(
signum: int, signum: int,
frame: 'frame', # type: ignore # noqa frame: 'frame', # type: ignore # noqa
@ -1501,7 +1505,9 @@ def sigint_shield(
# NOTE: don't emit this with `.pdb()` level in # NOTE: don't emit this with `.pdb()` level in
# root without a higher level. # root without a higher level.
log.runtime( log.runtime(
f'Ignoring SIGINT while debug REPL in use by child ' _ctlc_ignore_header
+
f' by child '
f'{uid_in_debug}\n' f'{uid_in_debug}\n'
) )
problem = None problem = None
@ -1535,7 +1541,9 @@ def sigint_shield(
# NOTE: since we emit this msg on ctl-c, we should # NOTE: since we emit this msg on ctl-c, we should
# also always re-print the prompt the tail block! # also always re-print the prompt the tail block!
log.pdb( log.pdb(
'Ignoring SIGINT while pdb REPL in use by root actor..\n' _ctlc_ignore_header
+
f' by root actor..\n'
f'{DebugStatus.repl_task}\n' f'{DebugStatus.repl_task}\n'
f' |_{repl}\n' f' |_{repl}\n'
) )
@ -1596,16 +1604,20 @@ def sigint_shield(
repl repl
): ):
log.pdb( log.pdb(
f'Ignoring SIGINT while local task using debug REPL\n' _ctlc_ignore_header
f'|_{repl_task}\n' +
f' by local task\n\n'
f'{repl_task}\n'
f' |_{repl}\n' f' |_{repl}\n'
) )
elif req_task: elif req_task:
log.debug( log.debug(
'Ignoring SIGINT while debug request task is open but either,\n' _ctlc_ignore_header
'- someone else is already REPL-in and has the `Lock`, or\n' +
'- some other local task already is replin?\n' f' by local request-task and either,\n'
f'|_{req_task}\n' f'- someone else is already REPL-in and has the `Lock`, or\n'
f'- some other local task already is replin?\n\n'
f'{req_task}\n'
) )
# TODO can we remove this now? # TODO can we remove this now?