[nanny] catch exception if nanny-desktop-blocker fails WIN32



commit f20f55a17f93ecdba44a7a8388d2a0ad41f89d83
Author: Roberto Majadas <roberto majadas openshine com>
Date:   Mon Nov 1 13:14:12 2010 +0100

    catch exception if nanny-desktop-blocker fails WIN32

 daemon/src/Win32SessionFiltering.py |   29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)
---
diff --git a/daemon/src/Win32SessionFiltering.py b/daemon/src/Win32SessionFiltering.py
index 54d0724..02c36ff 100644
--- a/daemon/src/Win32SessionFiltering.py
+++ b/daemon/src/Win32SessionFiltering.py
@@ -112,19 +112,22 @@ class Win32SessionBlocker(gobject.GObject) :
     def __launch_blocker_thread(self, user_id, win32sb):
         import subprocess
         import time
-
-        p = WinPopenAsUser(win32sb.sb)
-        print "[W32SessionFiltering] launching blocker (pid : %s)" % p.pid
-        while p.poll() == None :
-            time.sleep(1)
-            b = threads.blockingCallFromThread(reactor, win32sb.is_user_blocked, user_id)
-            if b == False:
-                p.kill()
-                print "[W32SessionFiltering] Unblocking session %s" % user_id
-                return
-
-        print "[W32SessionFiltering] blocker terminated by user interaction"
-        threads.blockingCallFromThread(reactor, win32sb.blocker_terminate_from_thread, user_id, p.poll())
+        try:
+            p = WinPopenAsUser(win32sb.sb)
+            print "[W32SessionFiltering] launching blocker (pid : %s)" % p.pid
+            while p.poll() == None :
+                time.sleep(1)
+                b = threads.blockingCallFromThread(reactor, win32sb.is_user_blocked, user_id)
+                if b == False:
+                    p.kill()
+                    print "[W32SessionFiltering] Unblocking session %s" % user_id
+                    return
+
+            print "[W32SessionFiltering] blocker terminated by user interaction"
+            threads.blockingCallFromThread(reactor, win32sb.blocker_terminate_from_thread, user_id, p.poll())
+        except:
+            print "[W32SessionFiltering] blocker terminated by exception"
+            threads.blockingCallFromThread(reactor, win32sb.blocker_terminate_from_thread, user_id, 1)
 
 class WinPopenAsUser :
     def __init__ (self, cmd):



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