Print bot stderr if a bot dies before ending.
authorW. Trevor King <wking@drexel.edu>
Tue, 7 Dec 2010 17:39:50 +0000 (12:39 -0500)
committerW. Trevor King <wking@drexel.edu>
Tue, 7 Dec 2010 17:39:50 +0000 (12:39 -0500)
table.py

index bea4513304a54e2b5b6bb4ff4b65651c5cafc2fb..b0d9556f38057be885bf0c75843a3f2d43630d7c 100644 (file)
--- 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):