#28014 closed Bug (worksforme)
"manage.py makemigrations --check" exits with 0 in case of exception
Reported by: | Daniel Hahler | Owned by: | nobody |
---|---|---|---|
Component: | Core (Management commands) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In case there is an exception from one of the migrations, it will print this,
but exits with status code 0.
% manage.py makemigrations --check INFO:root:settings.ENVIRONMENT: dev Traceback (most recent call last): File "…/project/bin/manage.py", line 8, in <module> execute_from_command_line(sys.argv) File "……/src/django/django/core/management/__init__.py", line 367, in execute_from_command_line utility.execute() File "……/src/django/django/core/management/__init__.py", line 359, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "……/src/django/django/core/management/base.py", line 294, in run_from_argv self.execute(*args, **cmd_options) File "……/src/django/django/core/management/base.py", line 345, in execute output = self.handle(*args, **options) File "……/src/django/django/core/management/commands/makemigrations.py", line 95, in handle loader = MigrationLoader(None, ignore_no_migrations=True) File "……/src/django/django/db/migrations/loader.py", line 52, in __init__ self.build_graph() File "……/src/django/django/db/migrations/loader.py", line 197, in build_graph self.load_disk() File "……/src/django/django/db/migrations/loader.py", line 108, in load_disk migration_module = import_module("%s.%s" % (module_name, migration_name)) File "…/pyenv/3.5.2/lib/python3.5/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 986, in _gcd_import File "<frozen importlib._bootstrap>", line 969, in _find_and_load File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 673, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 665, in exec_module File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed File "…/app/migrations/0100_feedback.py", line 12, in <module> raise Exception() Exception
This might be more an issue of manage.py
itself, which should exit non-zero
in case of any exception?!
try: execute_from_command_line(sys.argv) except Exception as e: traceback.print_exc() sys.exit(3)
Change History (3)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
I also can't reproduce:
$ python manage.py makemigrations --check Traceback (most recent call last): ... File "/home/tim/code/mysite/polls/migrations/0001_initial.py", line 37 raise Exception() Exception $ echo $? 1
comment:3 by , 8 years ago
Yes, it seems to work as expected.
I guess I got confused because I used the deprecated --exit
before, which would exit with 1 in case of no changes.
Replaced it with --check
now.
Note:
See TracTickets
for help on using tickets.
I could not reproduce this. It shows exit code 1 for versions 1.11rc1 and dev version on Exceptions.