Skip to content

Commit

Permalink
Print debugging info when a subcommand fails, even when ignore_errors…
Browse files Browse the repository at this point in the history
… is true.

When a subcommand gives an error and ignore_errors is false, we die with
the error output.  But when ignore_errors is true, there's no way to see
the error output, even when running with -d.  This change fixes that but
emitting the error output in debug mode.

I also changed the log messages a bit when running a command, to make it
clear that we're running a subcommand.

Reviewed at http://reviews.reviewboard.org/r/3007/
  • Loading branch information
csilvers authored and chipx86 committed Mar 29, 2012
1 parent a42d238 commit 2612bfd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions rbtools/utils/process.py
Expand Up @@ -31,9 +31,9 @@ def execute(command,
Utility function to execute a command and return the output.
"""
if isinstance(command, list):
logging.debug(subprocess.list2cmdline(command))
logging.debug('Running: ' + subprocess.list2cmdline(command))
else:
logging.debug(command)
logging.debug('Running: ' + command)

if env:
env.update(os.environ)
Expand Down Expand Up @@ -74,6 +74,9 @@ def execute(command,

if rc and not ignore_errors and rc not in extra_ignore_errors:
die('Failed to execute command: %s\n%s' % (command, data))
elif rc:
logging.debug('Command exited with rc %s: %s\n%s---'
% (rc, command, data))

if rc and none_on_ignored_error:
return None
Expand Down

0 comments on commit 2612bfd

Please sign in to comment.