diff options
author | Guido van Rossum <guido@python.org> | 1998-04-27 19:35:15 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-04-27 19:35:15 (GMT) |
commit | bee64533d68e35e9516cc2121afd0db1e063fa8c (patch) | |
tree | 99896e0db2258de344dc289eb217ca900ad2173f /Tools/webchecker/webchecker.py | |
parent | e86271af72ae66aa79b33106b900053446923ef4 (diff) | |
download | cpython-bee64533d68e35e9516cc2121afd0db1e063fa8c.zip cpython-bee64533d68e35e9516cc2121afd0db1e063fa8c.tar.gz cpython-bee64533d68e35e9516cc2121afd0db1e063fa8c.tar.bz2 |
Use a try-except so that the pickle file is written even when we die
because of an unexpected exception.
Diffstat (limited to 'Tools/webchecker/webchecker.py')
-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 5459e97..bf56cec 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): |