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:
parent
d69176090c
commit
5db24303b7
@ -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()
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user