1
0
Fork 0

commands: if there is no stderr output of failed command, show stdout

Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
This commit is contained in:
Jaroslav Škarvada 2013-02-14 15:17:17 +01:00
parent f47af4d4cc
commit cc4d90d42e

View file

@ -44,7 +44,10 @@ def execute(args):
out, err = proc.communicate()
if proc.returncode:
log.error("Executing %s error: %s" % (args[0], err[:-1]))
err_out = err[:-1]
if len(err_out) == 0:
err_out = out[:-1]
log.error("Executing %s error: %s" % (args[0], err_out))
except (OSError,IOError) as e:
log.error("Executing %s error: %s" % (args[0], e))
return out