Author: tack
Date: Tue Feb 19 18:11:12 2008
New Revision: 3119

Log:
Propogate _all_ exceptions (including KeyboardInterrupt/SystemExit)
in main.loop().  This allows KeyboardInterrupt to bubble up to the main loop
if one is running. Specifically this should fix ctrl-c during InProgress.wait()
going silently ignored.


Modified:
   trunk/base/src/notifier/main.py

Modified: trunk/base/src/notifier/main.py
==============================================================================
--- trunk/base/src/notifier/main.py     (original)
+++ trunk/base/src/notifier/main.py     Tue Feb 19 18:11:12 2008
@@ -109,18 +109,6 @@
     while condition() and not abort:
         try:
             notifier.step()
-        except (KeyboardInterrupt, SystemExit):
-            try:
-                # This looks stupid, I know that. The problem is that if we 
have
-                # a KeyboardInterrupt, that flag is still valid somewhere 
inside
-                # python. The next system call will fail because of that. 
Since we
-                # don't want a join of threads or similar fail, we use a very 
short
-                # sleep here. In most cases we won't sleep at all because this 
sleep
-                # fails. But after that everything is back to normal.
-                time.sleep(0.001)
-            except:
-                pass
-            break
         except Exception, e:
             if signals['exception'].emit(*sys.exc_info()) != False:
                 # Either there are no global exception handlers, or none of
@@ -151,7 +139,21 @@
         raise RuntimeError('Mainthread is already running')
 
     try:
-        loop(True)
+        # Nested try necessary because python 2.4 doesn't support
+        # try/except/finally.
+        try:
+            loop(True)
+        except (KeyboardInterrupt, SystemExit):
+            try:
+                # This looks stupid, I know that. The problem is that if we 
have
+                # a KeyboardInterrupt, that flag is still valid somewhere 
inside
+                # python. The next system call will fail because of that. 
Since we
+                # don't want a join of threads or similar fail, we use a very 
short
+                # sleep here. In most cases we won't sleep at all because this 
sleep
+                # fails. But after that everything is back to normal.
+                time.sleep(0.001)
+            except:
+                pass
     finally:
         stop()
 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to