summaryrefslogtreecommitdiff
path: root/coverage/control.py
diff options
context:
space:
mode:
Diffstat (limited to 'coverage/control.py')
-rw-r--r--coverage/control.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/coverage/control.py b/coverage/control.py
index 6387d0dd..a0571c97 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -536,12 +536,13 @@ class Coverage:
# Register our clean-up handlers.
atexit.register(self._atexit)
- is_main = (threading.current_thread() == threading.main_thread())
- if is_main and not env.WINDOWS:
- # The Python docs seem to imply that SIGTERM works uniformly even
- # on Windows, but that's not my experience, and this agrees:
- # https://stackoverflow.com/questions/35772001/x/35792192#35792192
- self._old_sigterm = signal.signal(signal.SIGTERM, self._on_sigterm)
+ if self.config.sigterm:
+ is_main = (threading.current_thread() == threading.main_thread())
+ if is_main and not env.WINDOWS:
+ # The Python docs seem to imply that SIGTERM works uniformly even
+ # on Windows, but that's not my experience, and this agrees:
+ # https://stackoverflow.com/questions/35772001/x/35792192#35792192
+ self._old_sigterm = signal.signal(signal.SIGTERM, self._on_sigterm)
def _init_data(self, suffix):
"""Create a data file if we don't have one yet."""