Skip to content

Commit

Permalink
Be more informative on command failures
Browse files Browse the repository at this point in the history
  • Loading branch information
yakky committed Jan 10, 2018
1 parent aa66728 commit 7224c3c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions djangocms_installer/django/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,13 @@ def create_project(config_data):
cmd_args = start_cmd + ['startproject'] + args
if config_data.verbose:
sys.stdout.write('Project creation command: {0}\n'.format(' '.join(cmd_args)))
output = subprocess.check_output(cmd_args)
sys.stdout.write(output.decode('utf-8'))
try:
output = subprocess.check_output(cmd_args, stderr=subprocess.STDOUT)
sys.stdout.write(output.decode('utf-8'))
except subprocess.CalledProcessError as e: # pragma: no cover
if config_data.verbose:
sys.stdout.write(e.output.decode('utf-8'))
raise


def _detect_migration_layout(vars, apps):
Expand Down Expand Up @@ -401,7 +406,9 @@ def setup_database(config_data):
command, env=env, stderr=subprocess.STDOUT
)
sys.stdout.write(output.decode('utf-8'))
except subprocess.CalledProcessError:
except subprocess.CalledProcessError as e: # pragma: no cover
if config_data.verbose:
sys.stdout.write(e.output.decode('utf-8'))
raise

if not config_data.no_user:
Expand Down

0 comments on commit 7224c3c

Please sign in to comment.