More specific errors on player crash

This commit is contained in:
Ruben van de Ven 2019-04-16 12:51:06 +02:00
parent 16a186dc89
commit 7bb3410ec5

View file

@ -308,7 +308,8 @@ class CommandHandler(object):
'event': 'playbackStart', 'event': 'playbackStart',
'msgId': msgId 'msgId': msgId
}) })
returnCode = self.playPopen.wait() out, err = self.playPopen.communicate()
returnCode = self.playPopen.returncode
logger.debug('finished') logger.debug('finished')
self.playPopen = None self.playPopen = None
else: else:
@ -316,11 +317,12 @@ class CommandHandler(object):
playCmd = ['espeak', '-p', '{0}'.format(pitch), text] playCmd = ['espeak', '-p', '{0}'.format(pitch), text]
self.playPopen = subprocess.Popen( self.playPopen = subprocess.Popen(
playCmd, stdout=subprocess.PIPE) playCmd, stdout=subprocess.PIPE)
returnCode = self.playPopen.wait() out, err = self.playPopen.communicate()
returnCode = self.playPopen.returncode
self.playPopen = None self.playPopen = None
if returnCode: if returnCode:
logger.critical("Had returncode {} on play: {}".format(returnCode, playCmd)) logger.critical("Had returncode {} on play: {}\n\n{}\n{}".format(returnCode, playCmd, out, err))
else: else:
logger.debug("Finished playback.") logger.debug("Finished playback.")