improve variable handling

This commit is contained in:
Jakob Ketterl 2020-02-27 18:50:53 +01:00
parent 388218f9df
commit c325368be8
1 changed files with 3 additions and 2 deletions

View File

@ -115,6 +115,7 @@ class dsp(object):
self.is_service = False
self.direwolf_config = None
self.direwolf_port = None
self.process = None
def set_service(self, flag=True):
self.is_service = flag
@ -744,9 +745,10 @@ class dsp(object):
def stop(self):
self.modification_lock.acquire()
self.running = False
if hasattr(self, "process"):
if self.process is not None:
try:
os.killpg(os.getpgid(self.process.pid), signal.SIGTERM)
self.process = None
except ProcessLookupError:
# been killed by something else, ignore
pass
@ -764,4 +766,3 @@ class dsp(object):
def __del__(self):
self.stop()
del self.process