forked from pallets/click
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
= Refactor BaseCommand to simplify Exit handling BaseCommand.main() will get the return value from `self.invoke` and pass it to `ctx.exit()`, so that commands which `return 1` will `ctx.exit(1)` This is not a behavioral change -- `ctx.exit()` already does this. Do not reraise Exit exceptions when invoked non-standalone. Instead, return their exit codes as the result of `BaseCommand.main`. So, a command which explicitly invokes `ctx.exit(0)` in its execution will effectively `return 0` instead of raising a specialized exception. = Make Exit its own RuntimeError subtype, don't pollute stdio on exit Exit exceptions should not be a subtype of ClickException with the output pretty-printing (`show()`) which happens when they are raised in non-standalone mode. That would make `ctx.exit(...)` needlessly pollute stderr. This would have downstream impact on everyone using context exit calls, and generally be a Bad Thing (tm). Instead, like Abort, Exit is a subclass of RuntimeError with very little "meat on its bones". It's an exception containing a single integer (exit code) which is then interpreted in that way in BaseCommand.main closes pallets#533 closes pallets#667
- Loading branch information
Showing
2 changed files
with
24 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters