summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x__init__.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/__init__.py b/__init__.py
index 707c60a..5fb1577 100755
--- a/__init__.py
+++ b/__init__.py
@@ -21,6 +21,7 @@ class Watcher(object):
f.write(str(self.child))
finally:
f.close()
+ signal.signal(signal.SIGTERM, self.sig_term)
self.watch()
def watch(self):
@@ -33,6 +34,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