The place you linked to is ignoring CommandError when parsing arguments. 
I'm not sure under what conditions this happens (if at all) -- the Django 
tests don't cover it.

As far as I know, BaseCommand already does sys.exit(1) when there's an 
unhandled exception: 
https://github.com/django/django/blob/df0a446fd4c864c003e4f941b5b7abd6f10c9427/django/core/management/base.py#L289-L300

Could you clarify how to reproduce the problem you're seeing?

On Monday, October 26, 2015 at 2:01:17 PM UTC-4, [email protected] 
wrote:
>
> Is it ok if I do a PR on this?  This seems like it would be really useful 
> for automation.
>
> -Ben
>
> On Thursday, October 22, 2015 at 2:20:18 AM UTC-7, Ben Liyanage wrote:
>>
>> Hey,
>>
>> What do you guys think about this feature request?
>>
>> > On CommandError, sys.exit(1)
>>
>> It would be pretty easy to do the sys.exit(1) right here: 
>>
>>
>> https://github.com/django/django/blob/df0a446fd4c864c003e4f941b5b7abd6f10c9427/django/core/management/__init__.py#L289
>>
>> This would allow you to fail an automated build when migrations (or any 
>> other management command) failed.  Currently I see no way of doing that.
>>
>> Beyond that, I noticed that the sys.exit(1) is not very consistently 
>> applied on the makemigrations management command (for example, it is not 
>> called when the --merge parameter is supplied).
>>
>> I can do the PR for the CommandError thing (unless anyone sees a reason 
>> not to, or that would not work/there is a better place to put it).
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/d0db82af-2861-421a-a1c5-2509f3ee05f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to