diff options
author | Felipe Contreras <felipe.contreras@gmail.com> | 2021-09-19 01:31:25 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-18 20:31:25 -1000 |
commit | 354d9713e79e999978238edca53ff5e9b7ca9488 (patch) | |
tree | 3a583538f4bcfd937abaa481e1f76ab4626dd855 | |
parent | 7b33ba88a6ab7446541c8ea70ec068663ef443d6 (diff) | |
download | asciidoc-py3-354d9713e79e999978238edca53ff5e9b7ca9488.tar.gz |
Cleanup outfile on system-exiting exceptions (#195)
-rw-r--r-- | asciidoc/asciidoc.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/asciidoc/asciidoc.py b/asciidoc/asciidoc.py index bf54477..07b23f7 100644 --- a/asciidoc/asciidoc.py +++ b/asciidoc/asciidoc.py @@ -6259,12 +6259,12 @@ def asciidoc(backend, doctype, confiles, infile, outfile, options): writer.close() finally: reader.closefile() - except KeyboardInterrupt: - raise - except Exception as e: + except BaseException as e: # Cleanup. if outfile and outfile != '<stdout>' and os.path.isfile(outfile): os.unlink(outfile) + if not isinstance(e, Exception): + raise # Build and print error description. msg = 'FAILED: ' if reader.cursor: |