Skip to content

Commit

Permalink
if exit_code is 1 we can still raise CommandError without returncode …
Browse files Browse the repository at this point in the history
…argument even on Django < 3.1
  • Loading branch information
trbs committed Sep 1, 2020
1 parent 03b8f89 commit b715590
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions django_extensions/management/commands/runscript.py
Expand Up @@ -291,6 +291,10 @@ def find_modules_for_script(script):
try:
raise CommandError("An error has occurred running scripts. See errors above.", returncode=self.last_exit_code)
except TypeError:
# Django < 3.1 fallback
if self.last_exit_code == 1:
# if exit_code is 1 we can still raise CommandError without returncode argument
raise CommandError("An error has occurred running scripts. See errors above.")
print(ERROR("An error has occurred running scripts. See errors above."))
if hasattr(self, 'running_tests'):
return
Expand Down

0 comments on commit b715590

Please sign in to comment.