Do not show a zero error code when cli exits from showing help (#935)

asyncclick raises a custom runtime exception when exiting help. This suppresses reporting it.
This commit is contained in:
Teemu R 2024-05-23 20:35:41 +02:00 committed by GitHub
parent c1e14832ef
commit b217811096
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -111,6 +111,10 @@ def CatchAllExceptions(cls):
def _handle_exception(debug, exc):
if isinstance(exc, click.ClickException):
raise
# Handle exit request from click.
if isinstance(exc, click.exceptions.Exit):
sys.exit(exc.exit_code)
echo(f"Raised error: {exc}")
if debug:
raise