summaryrefslogtreecommitdiff
path: root/coverage/control.py
diff options
context:
space:
mode:
authorLewis Gaul <lewis.gaul@gmail.com>2023-04-06 11:58:16 +0100
committerGitHub <noreply@github.com>2023-04-06 03:58:16 -0700
commitf27c9ca775173d32bf71aeca9075c70f893b6542 (patch)
tree7c1499d131bc74dc7fa9a5af4a1b2916a929a669 /coverage/control.py
parent3bc7d2ccdde692e6a5b968bb750751acc54b82a5 (diff)
downloadpython-coveragepy-git-f27c9ca775173d32bf71aeca9075c70f893b6542.tar.gz
fix: save coverage data on SIGTERM (#1600)
* Add test that reproduces the issue * Suggested fix - always save data in sigterm exit flow * Address test failures on MacOS due to lack of 'Terminated' output on SIGTERM
Diffstat (limited to 'coverage/control.py')
-rw-r--r--coverage/control.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/coverage/control.py b/coverage/control.py
index acce622d..e405a5bf 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -653,7 +653,7 @@ class Coverage(TConfigurable):
self._debug.write(f"{event}: pid: {os.getpid()}, instance: {self!r}")
if self._started:
self.stop()
- if self._auto_save:
+ if self._auto_save or event == "sigterm":
self.save()
def _on_sigterm(self, signum_unused: int, frame_unused: Optional[FrameType]) -> None: