summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2021-09-19 01:31:25 -0500
committerGitHub <noreply@github.com>2021-09-18 20:31:25 -1000
commit354d9713e79e999978238edca53ff5e9b7ca9488 (patch)
tree3a583538f4bcfd937abaa481e1f76ab4626dd855
parent7b33ba88a6ab7446541c8ea70ec068663ef443d6 (diff)
downloadasciidoc-py3-354d9713e79e999978238edca53ff5e9b7ca9488.tar.gz
Cleanup outfile on system-exiting exceptions (#195)
-rw-r--r--asciidoc/asciidoc.py6
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: