Skip to content

Commit 7fae775

Browse files
committed
Don't catch SystemExit in TracebackHandler
1 parent 0ec8780 commit 7fae775

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

consolekit/tracebacks.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class TracebackHandler:
5757
* :exc:`EOFError`
5858
* :exc:`KeyboardInterrupt`
5959
* :exc:`click.ClickException`
60+
* :exc:`SystemExit` (.. versionadded:: 1.1.2)
6061
6162
How these exceptions are handled can be changed, and supported can be added for
6263
further exception classes by subclassing this class.
@@ -80,6 +81,9 @@ def handle_ClickException(self, e: click.ClickException) -> bool: # noqa: D102
8081
def handle_Abort(self, e: click.Abort) -> bool: # noqa: D102
8182
raise e
8283

84+
def handle_SystemExit(self, e: SystemExit) -> bool: # noqa: D102
85+
raise e
86+
8387
def handle_FileNotFoundError(self, e: FileNotFoundError) -> bool: # noqa: D102
8488

8589
# this package

tests/test_tracebacks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def demo():
9393
assert result.exit_code == 1
9494

9595

96-
@pytest.mark.parametrize("exception", [EOFError, KeyboardInterrupt, click.Abort])
96+
@pytest.mark.parametrize("exception", [EOFError, KeyboardInterrupt, click.Abort, SystemExit])
9797
@contextmanagers
9898
def test_handle_tracebacks_ignored_exceptions(
9999
exception,

0 commit comments

Comments
 (0)