attempt better wsjt decoder handling
This commit is contained in:
parent
9923f5b18e
commit
8fe9bf6292
11
owrx/wsjt.py
11
owrx/wsjt.py
@ -150,14 +150,15 @@ class WsjtChopper(threading.Thread):
|
|||||||
decoder = subprocess.Popen(
|
decoder = subprocess.Popen(
|
||||||
self.decoder_commandline(file), stdout=subprocess.PIPE, cwd=self.tmp_dir, preexec_fn=lambda: os.nice(10)
|
self.decoder_commandline(file), stdout=subprocess.PIPE, cwd=self.tmp_dir, preexec_fn=lambda: os.nice(10)
|
||||||
)
|
)
|
||||||
while True:
|
for line in decoder.stdout.readline():
|
||||||
line = decoder.stdout.readline()
|
|
||||||
if line is None or (isinstance(line, bytes) and len(line) == 0):
|
|
||||||
break
|
|
||||||
self.outputWriter.send(line)
|
self.outputWriter.send(line)
|
||||||
rc = decoder.wait()
|
try:
|
||||||
|
rc = decoder.wait(timeout=10)
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
logger.warning("decoder return code: %i", rc)
|
logger.warning("decoder return code: %i", rc)
|
||||||
|
except subprocess.TimeoutExpired:
|
||||||
|
logger.warning("subprocess (pid=%i}) did not terminate correctly; sending kill signal.", decoder.pid)
|
||||||
|
decoder.kill()
|
||||||
os.unlink(file)
|
os.unlink(file)
|
||||||
|
|
||||||
def run(self) -> None:
|
def run(self) -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user