Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick91 committed Nov 5, 2024
1 parent 50671ba commit c6cd16e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions tests/test_exit_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ def main():
result = runner.invoke(app)
assert result.exit_code == 1

def test_keyboardinterrupt():
# Mainly for coverage/completeness
app = typer.Typer()

@app.command()
def main():
raise KeyboardInterrupt()

result = runner.invoke(app)
assert result.exit_code == 130
assert result.stdout == ""

def test_oserror():
# Mainly for coverage/completeness
Expand Down
2 changes: 1 addition & 1 deletion typer/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def _main(
click.echo(file=sys.stderr)
raise click.Abort() from e
except KeyboardInterrupt as e:
raise click.exceptions.Exit() from e
raise click.exceptions.Exit(130) from e
except click.ClickException as e:
if not standalone_mode:
raise
Expand Down

0 comments on commit c6cd16e

Please sign in to comment.