From 47dd8dc3325f96d49befc2609556e0d1615cf69d Mon Sep 17 00:00:00 2001 From: Reid Sunderland Date: Tue, 5 Mar 2024 16:15:12 +0000 Subject: [PATCH] Change raise_signal to os.kill for #948 --- sarracenia/moth/amqp.py | 5 +++-- sarracenia/moth/mqtt.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sarracenia/moth/amqp.py b/sarracenia/moth/amqp.py index f2ce773c1..fe8fa5141 100755 --- a/sarracenia/moth/amqp.py +++ b/sarracenia/moth/amqp.py @@ -34,6 +34,7 @@ from sarracenia.postformat import PostFormat from sarracenia.moth import Moth import signal +import os import time from urllib.parse import unquote @@ -406,7 +407,7 @@ def getSetup(self) -> None: signal.signal(signal.SIGINT, original_sigint) signal.signal(signal.SIGTERM, original_sigterm) if self.please_stop: - signal.raise_signal(signal.SIGINT) + os.kill(os.getpid(), signal.SIGINT) def putSetup(self) -> None: @@ -480,7 +481,7 @@ def putSetup(self) -> None: signal.signal(signal.SIGINT, original_sigint) signal.signal(signal.SIGTERM, original_sigterm) if self.please_stop: - signal.raise_signal(signal.SIGINT) + os.kill(os.getpid(), signal.SIGINT) def putCleanUp(self) -> None: diff --git a/sarracenia/moth/mqtt.py b/sarracenia/moth/mqtt.py index 278a447e1..5afa1d21b 100755 --- a/sarracenia/moth/mqtt.py +++ b/sarracenia/moth/mqtt.py @@ -34,6 +34,7 @@ from sarracenia.postformat import PostFormat from sarracenia.moth import Moth import signal +import os import ssl import threading import time @@ -417,7 +418,7 @@ def getSetup(self): signal.signal(signal.SIGINT, original_sigint) signal.signal(signal.SIGTERM, original_sigterm) if self.please_stop: - signal.raise_signal(signal.SIGINT) + os.kill(os.getpid(), signal.SIGINT) @@ -498,7 +499,7 @@ def putSetup(self): signal.signal(signal.SIGINT, original_sigint) signal.signal(signal.SIGTERM, original_sigterm) if self.please_stop: - signal.raise_signal(signal.SIGINT) + os.kill(os.getpid(), signal.SIGINT) def __sub_on_message(client, userdata, msg):