mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Revert "Revert "Merge pull request #1364 from evandroforks/fix_unclosed_python_file""
This reverts commit a2ac197fd7
.
Looks like it wasn't the cause of the previously reported problem:
https://forums.ankiweb.net/t/2-1-48-tts-problem/13587/2
This commit is contained in:
parent
96798f018a
commit
2a2469e7a2
1 changed files with 10 additions and 0 deletions
|
@ -313,6 +313,11 @@ class SimpleProcessPlayer(Player): # pylint: disable=abstract-method
|
||||||
if self._terminate_flag:
|
if self._terminate_flag:
|
||||||
self._process.terminate()
|
self._process.terminate()
|
||||||
self._process.wait(1)
|
self._process.wait(1)
|
||||||
|
try:
|
||||||
|
if self._process.stdin:
|
||||||
|
self._process.stdin.close()
|
||||||
|
except Exception as e:
|
||||||
|
print("unable to close stdin:", e)
|
||||||
self._process = None
|
self._process = None
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -321,6 +326,11 @@ class SimpleProcessPlayer(Player): # pylint: disable=abstract-method
|
||||||
self._process.wait(0.1)
|
self._process.wait(0.1)
|
||||||
if self._process.returncode != 0:
|
if self._process.returncode != 0:
|
||||||
print(f"player got return code: {self._process.returncode}")
|
print(f"player got return code: {self._process.returncode}")
|
||||||
|
try:
|
||||||
|
if self._process.stdin:
|
||||||
|
self._process.stdin.close()
|
||||||
|
except Exception as e:
|
||||||
|
print("unable to close stdin:", e)
|
||||||
self._process = None
|
self._process = None
|
||||||
return
|
return
|
||||||
except subprocess.TimeoutExpired:
|
except subprocess.TimeoutExpired:
|
||||||
|
|
Loading…
Reference in a new issue