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-12-07 17:25:54 +0000
commit3b9a640f8d19cd50d64ae2722304ace80453149e (patch)
treec62c9a85e3dea9580d1d88b0579594c6e57ac524 /bitbake/lib/bb/ui/crumbs/hobeventhandler.py
parenta2100b9b9d06c88f3791620729f64c39f8443f64 (diff)
downloadpoky-3b9a640f8d19cd50d64ae2722304ace80453149e.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: d1002e33e05d45a7e1bd65d79537419a4057e43a) 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 5d038f45ca..82ebc7d2e0 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -101,13 +101,9 @@ class HobHandler(gobject.GObject):
101 101
102 def runCommand(self, commandline): 102 def runCommand(self, commandline):
103 try: 103 try:
104 result = self.server.runCommand(commandline) 104 result, error = self.server.runCommand(commandline)
105 result_str = str(result) 105 if error:
106 if (result_str.startswith("Busy (") or 106 raise Exception("Error running command '%s': %s" % (commandline, error))
107 result_str == "No such command"):
108 raise Exception('%s has failed with output "%s". ' %
109 (str(commandline), result_str) +
110 "We recommend that you restart Hob.")
111 return result 107 return result
112 except Exception as e: 108 except Exception as e:
113 self.commands_async = [] 109 self.commands_async = []