Skip to content

Commit

Permalink
Print command debugging information only once
Browse files Browse the repository at this point in the history
When debugging is turned on and a command is run that fails or with
`print_on_success` on, the output for the command execution ends up
being printed twice. This change ensures that only one set of output
is printed at any point.

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
  • Loading branch information
stevekuznetsov committed Jan 25, 2017
1 parent 1aa39dc commit 459b377
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/tito/common.py
Expand Up @@ -413,12 +413,6 @@ def run_command(command, print_on_success=False):
If command fails, print status code and command output.
"""
(status, output) = getstatusoutput(command)

# ISSUE 253 - allow for better debug output
debug("Command: %s" % command)
debug("Status code: %s" % status)
debug("Command output: %s\n" % output)

if status > 0:
msgs = [
"Error running command: %s\n" % command,
Expand All @@ -431,6 +425,11 @@ def run_command(command, print_on_success=False):
print("Command: %s\n" % command)
print("Status code: %s\n" % status)
print("Command output: %s\n" % output)
else:
debug("Command: %s" % command)
debug("Status code: %s" % status)
debug("Command output: %s\n" % output)

return output


Expand Down

0 comments on commit 459b377

Please sign in to comment.