possible fix for invalid handle issue

https://anki.tenderapp.com/discussions/ankidesktop/39346-cant-add-audio-on-flash-drive
This commit is contained in:
Damien Elmes 2020-03-14 18:53:43 +10:00
parent 33f312315e
commit aad491dbb9

View File

@ -248,7 +248,11 @@ class SimpleProcessPlayer(Player): # pylint: disable=abstract-method
def _play(self, tag: AVTag) -> None: def _play(self, tag: AVTag) -> None:
assert isinstance(tag, SoundOrVideoTag) assert isinstance(tag, SoundOrVideoTag)
self._process = subprocess.Popen( self._process = subprocess.Popen(
self.args + [tag.filename], env=self.env, startupinfo=startup_info() self.args + [tag.filename],
env=self.env,
startupinfo=startup_info(),
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
) )
self._wait_for_termination(tag) self._wait_for_termination(tag)
@ -397,6 +401,8 @@ class SimpleMplayerSlaveModePlayer(SimpleMplayerPlayer):
self.args + [tag.filename], self.args + [tag.filename],
env=self.env, env=self.env,
stdin=subprocess.PIPE, stdin=subprocess.PIPE,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
startupinfo=startup_info(), startupinfo=startup_info(),
) )
self._wait_for_termination(tag) self._wait_for_termination(tag)