summaryrefslogtreecommitdiffstats
path: root/lib/bb/ui/ncurses.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:41:18 +0000
commit717831b8315cb3904d9b590e633000bc897e8fb6 (patch)
tree8fffd5913a72b7d1dd107d96b34c9abaaf0109a9 /lib/bb/ui/ncurses.py
parent90c0dfc39c3ce13e53c7c91168dc3401f7df476b (diff)
downloadopenembedded-core-contrib-717831b8315cb3904d9b590e633000bc897e8fb6.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/ncurses.py')
-rw-r--r--lib/bb/ui/ncurses.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/bb/ui/ncurses.py b/lib/bb/ui/ncurses.py
index f6ea7f9bca..98647fc3e0 100644
--- a/lib/bb/ui/ncurses.py
+++ b/lib/bb/ui/ncurses.py
@@ -236,15 +236,18 @@ class NCursesUI:
shutdown = 0
try:
- cmdline = server.runCommand(["getCmdLineAction"])
+ cmdline, error = server.runCommand(["getCmdLineAction"])
if not cmdline:
print("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.")
return
- elif not cmdline['action']:
- print(cmdline['msg'])
+ elif error:
+ print("Error getting bitbake commandline: %s" % error)
return
- ret = server.runCommand(cmdline['action'])
- if ret != True:
+ ret, error = server.runCommand(cmdline)
+ if error:
+ print("Error running command '%s': %s" % (cmdline, error))
+ return
+ elif ret != True:
print("Couldn't get default commandlind! %s" % ret)
return
except xmlrpclib.Fault as x:
@@ -345,10 +348,14 @@ class NCursesUI:
exitflag = True
if shutdown == 1:
mw.appendText("Second Keyboard Interrupt, stopping...\n")
- server.runCommand(["stateStop"])
+ _, error = server.runCommand(["stateStop"])
+ if error:
+ print("Unable to cleanly stop: %s" % error)
if shutdown == 0:
mw.appendText("Keyboard Interrupt, closing down...\n")
- server.runCommand(["stateShutdown"])
+ _, error = server.runCommand(["stateShutdown"])
+ if error:
+ print("Unable to cleanly shutdown: %s" % error)
shutdown = shutdown + 1
pass