Skip to content

Commit c6cd16e

Browse files
committed
Add test
1 parent 50671ba commit c6cd16e

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

tests/test_exit_errors.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ def main():
1818
result = runner.invoke(app)
1919
assert result.exit_code == 1
2020

21+
def test_keyboardinterrupt():
22+
# Mainly for coverage/completeness
23+
app = typer.Typer()
24+
25+
@app.command()
26+
def main():
27+
raise KeyboardInterrupt()
28+
29+
result = runner.invoke(app)
30+
assert result.exit_code == 130
31+
assert result.stdout == ""
2132

2233
def test_oserror():
2334
# Mainly for coverage/completeness

typer/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def _main(
209209
click.echo(file=sys.stderr)
210210
raise click.Abort() from e
211211
except KeyboardInterrupt as e:
212-
raise click.exceptions.Exit() from e
212+
raise click.exceptions.Exit(130) from e
213213
except click.ClickException as e:
214214
if not standalone_mode:
215215
raise

0 commit comments

Comments
 (0)