diff options
author | Guido van Rossum <guido@python.org> | 1998-04-27 19:35:15 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-04-27 19:35:15 +0000 |
commit | fc76d4f85b83568387a7e2a4bc83331a876059cd (patch) | |
tree | 629acb1d2e9bce79e0df1352c194e9b6983f62d1 /Tools | |
parent | b7ef13c07bdee210092556183d12fbbaa8db3df2 (diff) | |
download | cpython-fc76d4f85b83568387a7e2a4bc83331a876059cd.tar.gz |
Use a try-except so that the pickle file is written even when we die
because of an unexpected exception.
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/webchecker/webchecker.py | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/Tools/webchecker/webchecker.py b/Tools/webchecker/webchecker.py index 5459e9772b..bf56cece35 100755 --- a/Tools/webchecker/webchecker.py +++ b/Tools/webchecker/webchecker.py @@ -183,24 +183,28 @@ def main(): for arg in args: c.addroot(arg) - if not norun: + try: + + if not norun: + try: + c.run() + except KeyboardInterrupt: + if verbose > 0: + print "[run interrupted]" + try: - c.run() + c.report() except KeyboardInterrupt: if verbose > 0: - print "[run interrupted]" + print "[report interrupted]" - try: - c.report() - except KeyboardInterrupt: - if verbose > 0: - print "[report interrupted]" - - if c.save_pickle(dumpfile): - if dumpfile == DUMPFILE: - print "Use ``%s -R'' to restart." % sys.argv[0] - else: - print "Use ``%s -R -d %s'' to restart." % (sys.argv[0], dumpfile) + finally: + if c.save_pickle(dumpfile): + if dumpfile == DUMPFILE: + print "Use ``%s -R'' to restart." % sys.argv[0] + else: + print "Use ``%s -R -d %s'' to restart." % (sys.argv[0], + dumpfile) def load_pickle(dumpfile=DUMPFILE, verbose=VERBOSE): |