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")
|
self.getName() + ".prof")
|
||||||
except:
|
except:
|
||||||
self.setExitCause('EXCEPTION')
|
self.setExitCause('EXCEPTION')
|
||||||
|
if sys:
|
||||||
self.setExitException(sys.exc_info()[1])
|
self.setExitException(sys.exc_info()[1])
|
||||||
sbuf = StringIO()
|
sbuf = StringIO()
|
||||||
traceback.print_exc(file = sbuf)
|
traceback.print_exc(file = sbuf)
|
||||||
@ -168,6 +169,7 @@ class ExitNotifyThread(Thread):
|
|||||||
if not hasattr(self, 'exitmessage'):
|
if not hasattr(self, 'exitmessage'):
|
||||||
self.setExitMessage(None)
|
self.setExitMessage(None)
|
||||||
|
|
||||||
|
if exitthreads:
|
||||||
exitthreads.put(self, True)
|
exitthreads.put(self, True)
|
||||||
|
|
||||||
def setExitCause(self, cause):
|
def setExitCause(self, cause):
|
||||||
@ -230,6 +232,7 @@ class InstanceLimitedThread(ExitNotifyThread):
|
|||||||
try:
|
try:
|
||||||
ExitNotifyThread.run(self)
|
ExitNotifyThread.run(self)
|
||||||
finally:
|
finally:
|
||||||
|
if instancelimitedsems and instancelimitedsems[self.instancename]:
|
||||||
instancelimitedsems[self.instancename].release()
|
instancelimitedsems[self.instancename].release()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user