check_grid.py: print stderr when a subcommand fails

This commit is contained in:
Brian Warner 2009-06-22 19:28:33 -07:00
parent 8df15e9f30
commit f573bb2929

View File

@ -79,7 +79,7 @@ class GridTester:
self.nodedir = config.nodedir
def command(self, *cmd, **kwargs):
expected_rc = kwargs.get("expected_rc", None)
expected_rc = kwargs.get("expected_rc", 0)
stdin = kwargs.get("stdin", None)
if self.config["no"]:
return
@ -96,6 +96,9 @@ class GridTester:
(stdout,stderr) = p.communicate()
rc = p.returncode
if expected_rc != None and rc != expected_rc:
if stderr:
print "STDERR:"
print stderr
raise CommandFailed("command '%s' failed: rc=%d" % (cmd, rc))
return stdout, stderr