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