don't use communicate(), catch win32 error

This commit is contained in:
Damien Elmes 2009-06-18 07:11:39 +09:00
parent e6b207f7af
commit b079df2a13

View file

@ -183,19 +183,22 @@ def stopMplayer(restart=False):
if mplayerManager.mplayer: if mplayerManager.mplayer:
while 1: while 1:
try: try:
mplayerManager.mplayer.communicate("quit\n") mplayerManager.mplayer.stdin.write("quit\n")
break break
except OSError, e: except OSError, e:
if e.errno != errno.EINTR: if e.errno != errno.EINTR:
# osx throws interrupt errors regularly, but we want to # osx throws interrupt errors regularly, but we want to
# ignore other errors on shutdown # ignore other errors on shutdown
break break
except IOError:
# already closed
break
except ValueError: except ValueError:
# already closed # already closed
break break
if not restart: if not restart:
mplayerManager.mplayer = -1 mplayerManager.mplayer = -1
mplayerCond.notify() mplayerCond.notifyAll()
mplayerCond.release() mplayerCond.release()
def stopMplayerOnce(): def stopMplayerOnce():