Commit 7f7c9c2c authored by Klaus Aehlig's avatar Klaus Aehlig

Don't lose stdout/stderr in AssertCommand

If a command fails/succeeds that should not do so,
show stdout and stderr. This information can be
relevant for debugging.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarPetr Pudlak <pudlak@google.com>
parent bbd3ac36
......@@ -189,7 +189,11 @@ def AssertCommand(cmd, fail=False, node=None, log_cmd=True, max_seconds=None):
rcode = popen.returncode
duration_seconds = TimedeltaToTotalSeconds(datetime.datetime.now() - start)
if fail is not None:
_AssertRetCode(rcode, fail, cmdstr, nodename)
try:
_AssertRetCode(rcode, fail, cmdstr, nodename)
except:
print "Stdout was:\n%s\nStderr was:\n%s\n" % (stdout, stderr)
raise
if max_seconds is not None:
if duration_seconds > max_seconds:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment