mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Merge pull request #1364 from evandroforks/fix_unclosed_python_file
Fix ResourceWarning: unclosed file <_io.BufferedWriter name=5>
This commit is contained in:
parent
251c5ae080
commit
c05475a49e
1 changed files with 4 additions and 0 deletions
|
@ -313,6 +313,8 @@ class SimpleProcessPlayer(Player): # pylint: disable=abstract-method
|
|||
if self._terminate_flag:
|
||||
self._process.terminate()
|
||||
self._process.wait(1)
|
||||
if self._process.stdin:
|
||||
self._process.stdin.close()
|
||||
self._process = None
|
||||
return
|
||||
|
||||
|
@ -321,6 +323,8 @@ class SimpleProcessPlayer(Player): # pylint: disable=abstract-method
|
|||
self._process.wait(0.1)
|
||||
if self._process.returncode != 0:
|
||||
print(f"player got return code: {self._process.returncode}")
|
||||
if self._process.stdin:
|
||||
self._process.stdin.close()
|
||||
self._process = None
|
||||
return
|
||||
except subprocess.TimeoutExpired:
|
||||
|
|
Loading…
Reference in a new issue