From 354d9713e79e999978238edca53ff5e9b7ca9488 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Sun, 19 Sep 2021 01:31:25 -0500 Subject: Cleanup outfile on system-exiting exceptions (#195) --- asciidoc/asciidoc.py | 6 +++--- 1 file 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 != '' and os.path.isfile(outfile): os.unlink(outfile) + if not isinstance(e, Exception): + raise # Build and print error description. msg = 'FAILED: ' if reader.cursor: -- cgit v1.2.1