Skip to content

Commit

Permalink
Handle CTRL+C better (codespell-project#3511)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwtoews committed Sep 9, 2024
1 parent 7f20219 commit 3a47391
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 1 addition & 4 deletions codespell_lib/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,4 @@
from ._codespell import _script_main

if __name__ == "__main__":
try:
sys.exit(_script_main())
except KeyboardInterrupt:
pass
sys.exit(_script_main())
7 changes: 6 additions & 1 deletion codespell_lib/_codespell.py
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,12 @@ def flatten_clean_comma_separated_arguments(

def _script_main() -> int:
"""Wrap to main() for setuptools."""
return main(*sys.argv[1:])
try:
return main(*sys.argv[1:])
except KeyboardInterrupt:
# User has typed CTRL+C
sys.stdout.write("\n")
return 130


def _usage_error(parser: argparse.ArgumentParser, message: str) -> int:
Expand Down

0 comments on commit 3a47391

Please sign in to comment.