mirror of
https://github.com/rpm-software-management/tito.git
synced 2025-02-23 12:12:47 +00:00
Print command debugging information only once
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>
This commit is contained in:
parent
1aa39dc089
commit
459b377a3d
1 changed files with 5 additions and 6 deletions
|
@ -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,
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue