It is possible for a CmdError to be raised with an exit_status of
None, if the command times out and cannot be SIGTERMed or SIGKILLed.
The CmdError.__str__ method needs to be able to handle that case.
Risk: Low
Visibility: If a command times out and can't be SIGKILLed, we should
still be able to str the resulting CmdError.
Signed-off-by: John Admanski <jadmanski@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@2212 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/common_lib/error.py b/client/common_lib/error.py
index b56399f..b5148ec 100644
--- a/client/common_lib/error.py
+++ b/client/common_lib/error.py
@@ -103,8 +103,13 @@
def __str__(self):
- msg = "Command <%s> failed, rc=%d" % (self.command,
- self.result_obj.exit_status)
+ if self.result_obj.exit_status is None:
+ msg = "Command <%s> failed and is not responding to signals"
+ msg %= self.command
+ else:
+ msg = "Command <%s> failed, rc=%d"
+ msg %= (self.command, self.result_obj.exit_status)
+
if self.additional_text:
msg += ", " + self.additional_text
msg += '\n' + repr(self.result_obj)