Opened 12 years ago
Closed 12 years ago
#18387 closed New feature (fixed)
Provide a way to skip sys.exit() when using call_command()
Reported by: | Claude Paroz | Owned by: | nobody |
---|---|---|---|
Component: | Core (Management commands) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When running a management command from Python code with call_command, any CommandError raised in the execute method will call sys.exit(1). This is not always desirable, so we should provide a way to call call_command without this flaw.
This should also allow us to fix issues like #10200 painlessly.
Attachments (3)
Change History (6)
by , 12 years ago
Attachment: | 18387-1.diff added |
---|
comment:1 by , 12 years ago
After discussion on #django-dev, added a new patch that does not add any new parameter to call_command, but move sys.exit(1) higher in the calling stack so that it is not used with call_command. Only commands run from command line will reach exit().
comment:3 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Add raise_on_error option