delete configs after use

This commit is contained in:
Jakob Ketterl 2019-08-17 22:38:09 +02:00
parent 7e757c005c
commit 54bcba195d
1 changed files with 15 additions and 0 deletions

15
csdr.py
View File

@ -108,6 +108,8 @@ class dsp(object):
self.modification_lock = threading.Lock()
self.output = output
self.temporary_directory = "/tmp"
self.direwolf_config = None
self.direwolf_port = None
def set_temporary_directory(self, what):
self.temporary_directory = what
@ -361,6 +363,7 @@ class dsp(object):
if self.secondary_processes_running == False:
return
self.try_delete_pipes(self.secondary_pipe_names)
self.try_delete_configs()
if self.secondary_process_fft:
try:
os.killpg(os.getpgid(self.secondary_process_fft.pid), signal.SIGTERM)
@ -567,6 +570,18 @@ AGWPORT off
file.close()
else:
self.direwolf_config = None
self.direwolf_port = None
def try_delete_configs(self):
if self.direwolf_config:
try:
os.unlink(self.direwolf_config)
except FileNotFoundError:
# result suits our expectations. fine :)
pass
except Exception:
logger.exception("try_delete_configs()")
self.direwolf_config = None
def start(self):
self.modification_lock.acquire()