diff --git a/tractor/_actor.py b/tractor/_actor.py index 5177792..61755f7 100644 --- a/tractor/_actor.py +++ b/tractor/_actor.py @@ -1,5 +1,6 @@ """ Actor primitives and helpers + """ from collections import defaultdict from functools import partial @@ -11,6 +12,7 @@ import uuid import typing from typing import Dict, List, Tuple, Any, Optional, Union from types import ModuleType +import signal import sys import os from contextlib import ExitStack @@ -690,6 +692,12 @@ class Actor: for attr, value in parent_data.items(): setattr(self, attr, value) + # Disable sigint handling in children if NOT running in + # debug mode; we shouldn't need it thanks to our + # cancellation machinery. + if 'debug_mode' not in rvs: + signal.signal(signal.SIGINT, signal.SIG_IGN) + return chan, accept_addr except OSError: # failed to connect diff --git a/tractor/_entry.py b/tractor/_entry.py index 2f57048..da1f651 100644 --- a/tractor/_entry.py +++ b/tractor/_entry.py @@ -3,7 +3,6 @@ Sub-process entry points. """ from functools import partial from typing import Tuple, Any -import signal import trio # type: ignore @@ -15,7 +14,7 @@ log = get_logger(__name__) def _mp_main( - actor: 'Actor', # type: ignore + actor: 'Actor', # type: ignore # noqa accept_addr: Tuple[str, int], forkserver_info: Tuple[Any, Any, Any, Any, Any], start_method: str, @@ -54,16 +53,13 @@ def _mp_main( def _trio_main( - actor: 'Actor', # type: ignore + actor: 'Actor', # type: ignore # noqa *, parent_addr: Tuple[str, int] = None, ) -> None: """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) + """ log.info(f"Started new trio process for {actor.uid}") if actor.loglevel is not None: