From: W. Trevor King Date: Tue, 7 Dec 2010 17:39:50 +0000 (-0500) Subject: Print bot stderr if a bot dies before ending. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a1980ff713aabd2fb7faf593551552ce32345741;p=poker.git Print bot stderr if a bot dies before ending. --- diff --git a/table.py b/table.py index bea4513..b0d9556 100644 --- a/table.py +++ b/table.py @@ -41,11 +41,15 @@ class Player (object): def kill(self): if self._proc != None: - self._proc.stdin.write('END\n') - self._proc.stdin.flush() + try: + self._proc.stdin.write('END\n') + self._proc.stdin.flush() + except IOError, e: + pass + stdout,stderr = self._proc.communicate() exit_code = self._proc.wait() - assert exit_code == 0, 'Error exiting from %s: %d' % ( - self, exit_code) + assert exit_code == 0, 'Error exiting from %s: %d\n%s' % ( + self, exit_code, stderr) self._proc = None def __str__(self):