It's not very exciting to look at a whole stack trace just because someone
hit ctrl-c, especially since that's designed to work fine. Trim it down in
that case.
git.check_repo_or_die()
indexfile = opt.indexfile or git.repo('bupindex')
+handle_ctrl_c()
+
if opt.check:
log('check: starting initial check.\n')
check_index(index.Reader(indexfile))
oldref = refname and git.read_ref(refname) or None
w = git.PackWriter()
+handle_ctrl_c()
+
def eatslash(dir):
if dir.endswith('/'):
def progress(s):
if istty:
log(s)
+
+
+def handle_ctrl_c():
+ oldhook = sys.excepthook
+ def newhook(exctype, value, traceback):
+ if exctype == KeyboardInterrupt:
+ log('Interrupted.\n')
+ else:
+ return oldhook(exctype, value, traceback)
+ sys.excepthook = newhook