mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #18387 -- Do not call sys.exit during call_command.
Moved sys.exit(1) so as failing management commands reach it only when running from command line.
This commit is contained in:
parent
4423757c0c
commit
f2b6763ad7
7 changed files with 56 additions and 44 deletions
|
@ -317,8 +317,12 @@ Exception class indicating a problem while executing a management
|
|||
command.
|
||||
|
||||
If this exception is raised during the execution of a management
|
||||
command, it will be caught and turned into a nicely-printed error
|
||||
message to the appropriate output stream (i.e., stderr); as a
|
||||
result, raising this exception (with a sensible description of the
|
||||
command from a command line console, it will be caught and turned into a
|
||||
nicely-printed error message to the appropriate output stream (i.e., stderr);
|
||||
as a result, raising this exception (with a sensible description of the
|
||||
error) is the preferred way to indicate that something has gone
|
||||
wrong in the execution of a command.
|
||||
|
||||
If a management command is called from code through
|
||||
:ref:`call_command <call-command>`, it's up to you to catch the exception
|
||||
when needed.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue