#24384: compilemessages shouldn't return with exit code 0 when it fails
------------------------------------------------+------------------------
               Reporter:  aaugustin             |          Owner:  nobody
                   Type:  Bug                   |         Status:  new
              Component:  Internationalization  |        Version:  master
               Severity:  Normal                |       Keywords:
           Triage Stage:  Unreviewed            |      Has patch:  0
    Needs documentation:  0                     |    Needs tests:  0
Patch needs improvement:  0                     |  Easy pickings:  0
                  UI/UX:  0                     |
------------------------------------------------+------------------------
 When compilemessages is run on a read-only location, it displays a
 messages to standard error and terminates with exit code 0. It should have
 exit code 1.

 Patch:

 {{{
 diff --git a/django/core/management/commands/compilemessages.py
 b/django/core/management/commands/compilemessages.py
 index dbadac0..75f3c57 100644
 --- a/django/core/management/commands/compilemessages.py
 +++ b/django/core/management/commands/compilemessages.py
 @@ -108,9 +108,9 @@ class Command(BaseCommand):

              # Check writability on first location
              if i == 0 and not is_writable(npath(base_path + '.mo')):
 -                self.stderr.write("The po files under %s are in a
 seemingly not writable location. "
 -                                  "mo files will not be updated/created."
 % dirpath)
 -                return
 +                raise CommandError("The po files under %s are in a
 seemingly "
 +                                   "not writable location. mo files will
 not "
 +                                   "be updated/created." % dirpath)

              args = [self.program] + self.program_options + ['-o',
                      npath(base_path + '.mo'), npath(base_path + '.po')]
 }}}

 With this change, the output is exactly the same, but the exit code
 reflects the failure and the --traceback option works.

 I don't quite have the motivation to write tests for this change :-/

--
Ticket URL: <https://code.djangoproject.com/ticket/24384>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.b029fbfb32d76a267626b9ed6f85e97d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to