Final batch of code stability updates before anouther bout of extended testing. Still plenty to go, but making progress.

This commit is contained in:
Storm Dragon
2025-06-20 03:34:50 -04:00
parent 64e79f6945
commit dda84b9905
7 changed files with 48 additions and 15 deletions

View File

@ -10,6 +10,7 @@ from threading import Thread, Lock
from queue import Queue, Empty
import shlex
from subprocess import Popen
import subprocess
from fenrirscreenreader.core.speechDriver import speechDriver
class speakQueue(Queue):
@ -77,10 +78,18 @@ class driver(speechDriver):
if self.proc:
try:
self.proc.terminate()
# Wait for process to finish to prevent zombies
try:
self.proc.wait(timeout=1.0)
except subprocess.TimeoutExpired:
# If terminate didn't work, force kill
self.proc.kill()
self.proc.wait(timeout=1.0)
except Exception as e:
self.env['runtime']['debug'].writeDebugOut('speechDriver:Cancel:self.proc.terminate():' + str(e),debug.debugLevel.WARNING)
try:
self.proc.kill()
self.proc.wait(timeout=1.0) # Wait after kill to prevent zombies
except Exception as e:
self.env['runtime']['debug'].writeDebugOut('speechDriver:Cancel:self.proc.kill():' + str(e),debug.debugLevel.WARNING)
self.proc = None