correctly close iqtee / iqtee2 pipes

This commit is contained in:
Jakob Ketterl 2020-07-18 20:00:49 +02:00
parent e53f1f60eb
commit 174e9afa7b

View File

@ -95,9 +95,8 @@ class Pipe(object):
self.file = open(self.path, self.direction, encoding=self.encoding)
def close(self):
if self.file is None:
return
try:
if self.file is not None:
self.file.close()
os.unlink(self.path)
except FileNotFoundError:
@ -685,6 +684,9 @@ class dsp(object):
def try_create_pipes(self, pipe_names, command_base):
for pipe_name, pipe_type in pipe_names.items():
if self.has_pipe(pipe_name):
logger.warning("{pipe_name} is still in use", pipe_name=pipe_name)
self.pipes[pipe_name].close()
if "{" + pipe_name + "}" in command_base:
p = self.pipe_base_path + pipe_name
encoding = None