summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2015-12-03 03:24:05 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2015-12-03 03:24:05 +0100
commit4b905606692a2f147946505abe6ade1c241d1000 (patch)
tree3c7df287e32da8b5f8ec0aeb9ba93f03ac2eef5b
parent77205767d936e9abc4881468348aed7208d61a49 (diff)
parent64807e132ef0db1191bb61ed92bb5730b58a5114 (diff)
downloadbot-4b905606692a2f147946505abe6ade1c241d1000.tar.gz
bot-4b905606692a2f147946505abe6ade1c241d1000.tar.bz2
bot-4b905606692a2f147946505abe6ade1c241d1000.zip
Merge remote branch 'rmoore/sbp' into HEAD
* rmoore/sbp: Make phenny kill its child threads then exit when it receives a SIGTERM signal.
-rwxr-xr-x__init__.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/__init__.py b/__init__.py
index 5699583..fa76316 100755
--- a/__init__.py
+++ b/__init__.py
@@ -15,6 +15,7 @@ class Watcher(object):
def __init__(self):
self.child = os.fork()
if self.child != 0:
+ signal.signal(signal.SIGTERM, self.sig_term)
self.watch()
def watch(self):
@@ -27,6 +28,10 @@ class Watcher(object):
try: os.kill(self.child, signal.SIGKILL)
except OSError: pass
+ def sig_term(self, signum, frame):
+ self.kill()
+ sys.exit()
+
def run_phenny(config):
if hasattr(config, 'delay'):
delay = config.delay