Skip to content

Commit

Permalink
Merge pull request #319 from nephila/hotfix/more_verbose
Browse files Browse the repository at this point in the history
Be more informative on command failures
  • Loading branch information
yakky authored Jan 10, 2018
2 parents cdacfd8 + ebd032e commit 7aa1ceb
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 7aa1ceb

Please sign in to comment.