Catch KeyboardInterrupt exceptions explicitely
Previously we did not catch KeyboardInterrupts explicitly as all of the code was executed in forked child threads which would never receive Ctrl-c exceptions. With the upcoming single threaded modus, this code can be run in the main thread however, so we need to take care of KeyboardInterrupts explicitly. This was done wherever we would catch *ALL* exceptions universally and print out an error message. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
383ae9e647
commit
1a1e68d8be
@ -288,6 +288,8 @@ class BaseFolder:
|
|||||||
self.savemessage(newuid, message, flags, rtime)
|
self.savemessage(newuid, message, flags, rtime)
|
||||||
self.deletemessage(uid)
|
self.deletemessage(uid)
|
||||||
uid = newuid
|
uid = newuid
|
||||||
|
except (KeyboardInterrupt):
|
||||||
|
raise
|
||||||
except:
|
except:
|
||||||
self.ui.warn("ERROR attempting to copy message " + str(uid) \
|
self.ui.warn("ERROR attempting to copy message " + str(uid) \
|
||||||
+ " for account " + self.getaccountname() + ":" + str(sys.exc_info()[1]))
|
+ " for account " + self.getaccountname() + ":" + str(sys.exc_info()[1]))
|
||||||
@ -393,6 +395,8 @@ class BaseFolder:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
self.syncmessagesto_neguid(dest, applyto)
|
self.syncmessagesto_neguid(dest, applyto)
|
||||||
|
except (KeyboardInterrupt):
|
||||||
|
raise
|
||||||
except:
|
except:
|
||||||
self.ui.warn("ERROR attempting to handle negative uids " \
|
self.ui.warn("ERROR attempting to handle negative uids " \
|
||||||
+ "for account " + self.getaccountname() + ":" + str(sys.exc_info()[1]))
|
+ "for account " + self.getaccountname() + ":" + str(sys.exc_info()[1]))
|
||||||
@ -402,6 +406,8 @@ class BaseFolder:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
self.syncmessagesto_delete(dest, applyto)
|
self.syncmessagesto_delete(dest, applyto)
|
||||||
|
except (KeyboardInterrupt):
|
||||||
|
raise
|
||||||
except:
|
except:
|
||||||
self.ui.warn("ERROR attempting to delete messages " \
|
self.ui.warn("ERROR attempting to delete messages " \
|
||||||
+ "for account " + self.getaccountname() + ":" + str(sys.exc_info()[1]))
|
+ "for account " + self.getaccountname() + ":" + str(sys.exc_info()[1]))
|
||||||
@ -412,6 +418,8 @@ class BaseFolder:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
self.syncmessagesto_flags(dest, applyto)
|
self.syncmessagesto_flags(dest, applyto)
|
||||||
|
except (KeyboardInterrupt):
|
||||||
|
raise
|
||||||
except:
|
except:
|
||||||
self.ui.warn("ERROR attempting to sync flags " \
|
self.ui.warn("ERROR attempting to sync flags " \
|
||||||
+ "for account " + self.getaccountname() + ":" + str(sys.exc_info()[1]))
|
+ "for account " + self.getaccountname() + ":" + str(sys.exc_info()[1]))
|
||||||
|
@ -108,7 +108,10 @@ class LocalStatusFolder(BaseFolder):
|
|||||||
fd = os.open(os.path.dirname(self.filename), os.O_RDONLY)
|
fd = os.open(os.path.dirname(self.filename), os.O_RDONLY)
|
||||||
os.fsync(fd)
|
os.fsync(fd)
|
||||||
os.close(fd)
|
os.close(fd)
|
||||||
|
except (KeyboardInterrupt):
|
||||||
|
raise
|
||||||
except:
|
except:
|
||||||
|
#TODO, we should catch a specific Exception here, not ALL. But which?
|
||||||
pass
|
pass
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
|
@ -163,10 +163,11 @@ class BaseRepository(CustomConfig.ConfigHelperMixin):
|
|||||||
dest.makefolder(key)
|
dest.makefolder(key)
|
||||||
for copyfolder in copyfolders:
|
for copyfolder in copyfolders:
|
||||||
copyfolder.makefolder(key.replace(dest.getsep(), copyfolder.getsep()))
|
copyfolder.makefolder(key.replace(dest.getsep(), copyfolder.getsep()))
|
||||||
|
except (KeyboardInterrupt):
|
||||||
|
raise
|
||||||
except:
|
except:
|
||||||
getglobalui().warn("ERROR Attempting to make folder " \
|
getglobalui().warn("ERROR Attempting to make folder " \
|
||||||
+ key + ":" +str(sys.exc_info()[1]))
|
+ key + ":" +str(sys.exc_info()[1]))
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Find deleted folders.
|
# Find deleted folders.
|
||||||
|
Loading…
Reference in New Issue
Block a user