diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2013-07-25 19:28:19 +0200 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2013-07-25 19:28:19 +0200 |
commit | 2704ff4840fca1a07fd7f32775b8b9d4b7a3a13b (patch) | |
tree | 651a5874e8457af886402fec56ee9c2ef6a5291f /__init__.py | |
parent | 377d179f2ba537a6bcf8a6cc72df702206a0e3e2 (diff) | |
parent | 64807e132ef0db1191bb61ed92bb5730b58a5114 (diff) | |
download | bot-2704ff4840fca1a07fd7f32775b8b9d4b7a3a13b.tar.gz bot-2704ff4840fca1a07fd7f32775b8b9d4b7a3a13b.tar.bz2 bot-2704ff4840fca1a07fd7f32775b8b9d4b7a3a13b.zip |
Merge remote branch 'rmoore/sbp'2_git90
* rmoore/sbp:
Make phenny kill its child threads then exit when it receives a SIGTERM signal.
Conflicts:
__init__.py
Diffstat (limited to '__init__.py')
-rwxr-xr-x | __init__.py | 5 |
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 |