From 7bb3410ec5f8a348f28bb8220f554b8eabc4bd42 Mon Sep 17 00:00:00 2001 From: Ruben van de Ven Date: Tue, 16 Apr 2019 12:51:06 +0200 Subject: [PATCH] More specific errors on player crash --- hugvey/client.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hugvey/client.py b/hugvey/client.py index d3c015b..b6bd27a 100644 --- a/hugvey/client.py +++ b/hugvey/client.py @@ -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.")