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
@ -229,11 +229,11 @@ def syncfolder(accountname, remoterepos, remotefolder, localrepos,
|
|||||||
if len(localfolder.getmessagelist()) or len(statusfolder.getmessagelist()):
|
if len(localfolder.getmessagelist()) or len(statusfolder.getmessagelist()):
|
||||||
if not localfolder.isuidvalidityok():
|
if not localfolder.isuidvalidityok():
|
||||||
ui.validityproblem(localfolder)
|
ui.validityproblem(localfolder)
|
||||||
localrepos.restore_atime()
|
localrepos.restore_atime()
|
||||||
return
|
return
|
||||||
if not remotefolder.isuidvalidityok():
|
if not remotefolder.isuidvalidityok():
|
||||||
ui.validityproblem(remotefolder)
|
ui.validityproblem(remotefolder)
|
||||||
localrepos.restore_atime()
|
localrepos.restore_atime()
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
localfolder.saveuidvalidity()
|
localfolder.saveuidvalidity()
|
||||||
|
@ -159,16 +159,18 @@ class ExitNotifyThread(Thread):
|
|||||||
self.getName() + ".prof")
|
self.getName() + ".prof")
|
||||||
except:
|
except:
|
||||||
self.setExitCause('EXCEPTION')
|
self.setExitCause('EXCEPTION')
|
||||||
self.setExitException(sys.exc_info()[1])
|
if sys:
|
||||||
sbuf = StringIO()
|
self.setExitException(sys.exc_info()[1])
|
||||||
traceback.print_exc(file = sbuf)
|
sbuf = StringIO()
|
||||||
self.setExitStackTrace(sbuf.getvalue())
|
traceback.print_exc(file = sbuf)
|
||||||
|
self.setExitStackTrace(sbuf.getvalue())
|
||||||
else:
|
else:
|
||||||
self.setExitCause('NORMAL')
|
self.setExitCause('NORMAL')
|
||||||
if not hasattr(self, 'exitmessage'):
|
if not hasattr(self, 'exitmessage'):
|
||||||
self.setExitMessage(None)
|
self.setExitMessage(None)
|
||||||
|
|
||||||
exitthreads.put(self, True)
|
if exitthreads:
|
||||||
|
exitthreads.put(self, True)
|
||||||
|
|
||||||
def setExitCause(self, cause):
|
def setExitCause(self, cause):
|
||||||
self.exitcause = cause
|
self.exitcause = cause
|
||||||
@ -230,7 +232,8 @@ class InstanceLimitedThread(ExitNotifyThread):
|
|||||||
try:
|
try:
|
||||||
ExitNotifyThread.run(self)
|
ExitNotifyThread.run(self)
|
||||||
finally:
|
finally:
|
||||||
instancelimitedsems[self.instancename].release()
|
if instancelimitedsems and instancelimitedsems[self.instancename]:
|
||||||
|
instancelimitedsems[self.instancename].release()
|
||||||
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
|
Loading…
x
Reference in New Issue
Block a user