Merge pull request #21 from rmoore/master
Add signal handling to __init__
This commit is contained in:
@@ -15,6 +15,7 @@ class Watcher(object):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.child = os.fork()
|
self.child = os.fork()
|
||||||
if self.child != 0:
|
if self.child != 0:
|
||||||
|
signal.signal(signal.SIGTERM, self.sig_term)
|
||||||
self.watch()
|
self.watch()
|
||||||
|
|
||||||
def watch(self):
|
def watch(self):
|
||||||
@@ -27,6 +28,10 @@ class Watcher(object):
|
|||||||
try: os.kill(self.child, signal.SIGKILL)
|
try: os.kill(self.child, signal.SIGKILL)
|
||||||
except OSError: pass
|
except OSError: pass
|
||||||
|
|
||||||
|
def sig_term(self, signum, frame):
|
||||||
|
self.kill()
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
def run_phenny(config):
|
def run_phenny(config):
|
||||||
if hasattr(config, 'delay'):
|
if hasattr(config, 'delay'):
|
||||||
delay = config.delay
|
delay = config.delay
|
||||||
|
|||||||
Reference in New Issue
Block a user