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',
'msgId': msgId
})
returnCode = self.playPopen.wait()
out, err = self.playPopen.communicate()
returnCode = self.playPopen.returncode
logger.debug('finished')
self.playPopen = None
else:
@ -316,11 +317,12 @@ class CommandHandler(object):
playCmd = ['espeak', '-p', '{0}'.format(pitch), text]
self.playPopen = subprocess.Popen(
playCmd, stdout=subprocess.PIPE)
returnCode = self.playPopen.wait()
out, err = self.playPopen.communicate()
returnCode = self.playPopen.returncode
self.playPopen = None
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:
logger.debug("Finished playback.")