gnome-games r8263 - trunk/gnome-sudoku/src



Author: rancell
Date: Thu Nov  6 11:08:29 2008
New Revision: 8263
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8263&view=rev

Log:
Catch errors writing to stdout (Bug #523062)

Modified:
   trunk/gnome-sudoku/src/gnome-sudoku.in.in

Modified: trunk/gnome-sudoku/src/gnome-sudoku.in.in
==============================================================================
--- trunk/gnome-sudoku/src/gnome-sudoku.in.in	(original)
+++ trunk/gnome-sudoku/src/gnome-sudoku.in.in	Thu Nov  6 11:08:29 2008
@@ -9,6 +9,21 @@
 # software under the terms of the GNU General Public License, version
 # 2 or later.
 
+# Ignore any exceptions writing to stdout using print statements
+class SafeStdout:
+    def __init__(self):
+        self.stdout = sys.stdout
+    
+    def fileno(self):
+        return self.stdout.fileno()
+
+    def write(self, data):
+        try:
+            self.stdout.write(data)
+        except:
+            pass
+sys.stdout = SafeStdout()
+
 # Setup bugbuddy to report unhandled exceptions.
 try: 
   import bugbuddy



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]