summaryrefslogtreecommitdiffstats
path: root/lib/bb/ui/crumbs/hobeventhandler.py
diff options
context:
space:
mode:
authorChristopher Larson <chris_larson@mentor.com>2012-10-29 13:01:23 -0700
committerRoss Burton <ross.burton@intel.com>2012-12-03 16:59:23 +0000
commitd1002e33e05d45a7e1bd65d79537419a4057e43a (patch)
treeceaa3e46b1ee07c8350dfe17b2de0028642cee8f /lib/bb/ui/crumbs/hobeventhandler.py
parent4cd0200e96fb282980a945b80af641a6e022e0b4 (diff)
downloadbitbake-d1002e33e05d45a7e1bd65d79537419a4057e43a.tar.gz
command: add error to return of runCommand
Currently, command.py can return an error message from runCommand, due to being unable to run the command, yet few of our UIs (just hob) can handle it today. This can result in seeing a TypeError with traceback in certain rare circumstances. To resolve this, we need a clean way to get errors back from runCommand, without having to isinstance() the return value. This implements such a thing by making runCommand also return an error (or None if no error occurred). As runCommand now has a method of returning errors, we can also alter the getCmdLineAction bits such that the returned value is just the action, not an additional message. If a sync command wants to return an error, it raises CommandError(message), and the message will be passed to the caller appropriately. Example Usage: result, error = server.runCommand(...) if error: log.error('Unable to run command: %s' % error) return 1 Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/ui/crumbs/hobeventhandler.py')
-rw-r--r--lib/bb/ui/crumbs/hobeventhandler.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/bb/ui/crumbs/hobeventhandler.py b/lib/bb/ui/crumbs/hobeventhandler.py
index 5d038f45c..82ebc7d2e 100644
--- a/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/lib/bb/ui/crumbs/hobeventhandler.py
@@ -101,13 +101,9 @@ class HobHandler(gobject.GObject):
def runCommand(self, commandline):
try:
- result = self.server.runCommand(commandline)
- result_str = str(result)
- if (result_str.startswith("Busy (") or
- result_str == "No such command"):
- raise Exception('%s has failed with output "%s". ' %
- (str(commandline), result_str) +
- "We recommend that you restart Hob.")
+ result, error = self.server.runCommand(commandline)
+ if error:
+ raise Exception("Error running command '%s': %s" % (commandline, error))
return result
except Exception as e:
self.commands_async = []