Patch to make exit on Ctrl-C cleaner

From Jim Pryor

The first, "cleanup.patch", cleans up a few spots that tend to throw
exceptions for me as offlineimap is exiting from a KeyboardInterrupt.
This commit is contained in:
John Goerzen 2008-12-01 16:10:49 -06:00
parent d69176090c
commit 5db24303b7
2 changed files with 11 additions and 8 deletions

View File

@ -159,6 +159,7 @@ class ExitNotifyThread(Thread):
self.getName() + ".prof")
except:
self.setExitCause('EXCEPTION')
if sys:
self.setExitException(sys.exc_info()[1])
sbuf = StringIO()
traceback.print_exc(file = sbuf)
@ -168,6 +169,7 @@ class ExitNotifyThread(Thread):
if not hasattr(self, 'exitmessage'):
self.setExitMessage(None)
if exitthreads:
exitthreads.put(self, True)
def setExitCause(self, cause):
@ -230,6 +232,7 @@ class InstanceLimitedThread(ExitNotifyThread):
try:
ExitNotifyThread.run(self)
finally:
if instancelimitedsems and instancelimitedsems[self.instancename]:
instancelimitedsems[self.instancename].release()