diff --git a/codespell_lib/__main__.py b/codespell_lib/__main__.py index 0a8630df52..ecc82e092b 100644 --- a/codespell_lib/__main__.py +++ b/codespell_lib/__main__.py @@ -3,7 +3,4 @@ from ._codespell import _script_main if __name__ == "__main__": - try: - sys.exit(_script_main()) - except KeyboardInterrupt: - pass + sys.exit(_script_main()) diff --git a/codespell_lib/_codespell.py b/codespell_lib/_codespell.py index c7cc63bcfe..7198e99e9e 100644 --- a/codespell_lib/_codespell.py +++ b/codespell_lib/_codespell.py @@ -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: