From 641b53b96bccb763beb2ad257ff3d6593cf27fec Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 24 Feb 2010 20:59:45 -0500 Subject: When emulating the Python interpreter, don't print SystemExits tracebacks. --- coverage/cmdline.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'coverage/cmdline.py') diff --git a/coverage/cmdline.py b/coverage/cmdline.py index 0ab74759..c9383689 100644 --- a/coverage/cmdline.py +++ b/coverage/cmdline.py @@ -598,8 +598,13 @@ def main(): try: status = CoverageScript().command_line(sys.argv[1:]) except ExceptionDuringRun: + # An exception was caught while running the product code. The + # sys.exc_info() return tuple is packed into an ExceptionDuringRun + # exception. Note that the Python interpreter doesn't print SystemExit + # tracebacks, so it's important that we don't also. _, err, _ = sys.exc_info() - traceback.print_exception(*err.args) + if not isinstance(err.args[1], SystemExit): + traceback.print_exception(*err.args) status = ERR except CoverageException: _, err, _ = sys.exc_info() -- cgit v1.2.1