summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
diff options
context:
space:
mode:
authorChristopher Larson <chris_larson@mentor.com>2012-10-29 13:01:23 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-11-01 11:46:22 +0000
commitc1c20c02a0eb808a099bebfcc7e90188baa22ba4 (patch)
treefea4ff816120e77b9e8b5bc547703478387e067d /bitbake/lib/bb/ui/crumbs/hobeventhandler.py
parent99fa251b5696dff77358d514175bbb08802a7a02 (diff)
downloadpoky-c1c20c02a0eb808a099bebfcc7e90188baa22ba4.tar.gz
bitbake: 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 (Bitbake rev: 717831b8315cb3904d9b590e633000bc897e8fb6) Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/hobeventhandler.py')
-rw-r--r--bitbake/lib/bb/ui/crumbs/hobeventhandler.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index 350b00b9ae..5026bf740f 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -108,13 +108,9 @@ class HobHandler(gobject.GObject):
108 108
109 def runCommand(self, commandline): 109 def runCommand(self, commandline):
110 try: 110 try:
111 result = self.server.runCommand(commandline) 111 result, error = self.server.runCommand(commandline)
112 result_str = str(result) 112 if error:
113 if (result_str.startswith("Busy (") or 113 raise Exception("Error running command '%s': %s" % (commandline, error))
114 result_str == "No such command"):
115 raise Exception('%s has failed with output "%s". ' %
116 (str(commandline), result_str) +
117 "We recommend that you restart Hob.")
118 return result 114 return result
119 except Exception as e: 115 except Exception as e:
120 self.commands_async = [] 116 self.commands_async = []