gnome-games r8262 - branches/gnome-2-24/gnome-sudoku/src



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

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

Modified:
   branches/gnome-2-24/gnome-sudoku/src/gnome-sudoku.in.in

Modified: branches/gnome-2-24/gnome-sudoku/src/gnome-sudoku.in.in
==============================================================================
--- branches/gnome-2-24/gnome-sudoku/src/gnome-sudoku.in.in	(original)
+++ branches/gnome-2-24/gnome-sudoku/src/gnome-sudoku.in.in	Thu Nov  6 11:07:51 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]