Disable SIGINT handling in child processes

There seems to be no good reason not too since our cancellation
machinery/protocol should do this work when the root receives the
signal. This also (hopefully) helps with some debugging race condition
stuff.
debug_tests
Tyler Goodlet 2020-09-28 09:24:36 -04:00
parent f1b242f913
commit 363498b882
1 changed files with 5 additions and 0 deletions
tractor

View File

@ -3,6 +3,7 @@ Process entry points.
""" """
from functools import partial from functools import partial
from typing import Tuple, Any from typing import Tuple, Any
import signal
import trio # type: ignore import trio # type: ignore
@ -57,6 +58,10 @@ def _trio_main(
) -> None: ) -> None:
"""Entry point for a `trio_run_in_process` subactor. """Entry point for a `trio_run_in_process` subactor.
""" """
# Disable sigint handling in children;
# we don't need it thanks to our cancellation machinery.
signal.signal(signal.SIGINT, signal.SIG_IGN)
# TODO: make a global func to set this or is it too hacky? # TODO: make a global func to set this or is it too hacky?
# os.environ['PYTHONBREAKPOINT'] = 'tractor._debug.breakpoint' # os.environ['PYTHONBREAKPOINT'] = 'tractor._debug.breakpoint'