summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/knotty.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/ui/knotty.py')
-rw-r--r--bitbake/lib/bb/ui/knotty.py46
1 files changed, 32 insertions, 14 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index 6ac3d85b1e..b99a121729 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -217,9 +217,19 @@ class TerminalFilter(object):
217def main(server, eventHandler, tf = TerminalFilter): 217def main(server, eventHandler, tf = TerminalFilter):
218 218
219 # Get values of variables which control our output 219 # Get values of variables which control our output
220 includelogs = server.runCommand(["getVariable", "BBINCLUDELOGS"]) 220 includelogs, error = server.runCommand(["getVariable", "BBINCLUDELOGS"])
221 loglines = server.runCommand(["getVariable", "BBINCLUDELOGS_LINES"]) 221 if error:
222 consolelogfile = server.runCommand(["getVariable", "BB_CONSOLELOG"]) 222 logger.error("Unable to get the value of BBINCLUDELOGS variable: %s" % error)
223 return 1
224 loglines, error = server.runCommand(["getVariable", "BBINCLUDELOGS_LINES"])
225 if error:
226 logger.error("Unable to get the value of BBINCLUDELOGS_LINES variable: %s" % error)
227 return 1
228 consolelogfile, error = server.runCommand(["getVariable", "BB_CONSOLELOG"])
229 if error:
230 logger.error("Unable to get the value of BB_CONSOLELOG variable: %s" % error)
231 return 1
232
223 if sys.stdin.isatty() and sys.stdout.isatty(): 233 if sys.stdin.isatty() and sys.stdout.isatty():
224 log_exec_tty = True 234 log_exec_tty = True
225 else: 235 else:
@@ -240,19 +250,22 @@ def main(server, eventHandler, tf = TerminalFilter):
240 logger.addHandler(consolelog) 250 logger.addHandler(consolelog)
241 251
242 try: 252 try:
243 cmdline = server.runCommand(["getCmdLineAction"]) 253 cmdline, error = server.runCommand(["getCmdLineAction"])
244 if not cmdline: 254 if error:
255 logger.error("Unable to get bitbake commandline arguments: %s" % error)
256 return 1
257 elif not cmdline:
245 print("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.") 258 print("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.")
246 return 1 259 return 1
247 elif not cmdline['action']: 260 ret, error = server.runCommand(cmdline)
248 print(cmdline['msg']) 261 if error:
262 logger.error("Command '%s' failed: %s" % (cmdline, error))
249 return 1 263 return 1
250 ret = server.runCommand(cmdline['action']) 264 elif ret != True:
251 if ret != True: 265 logger.error("Command '%s' failed: returned %s" % (cmdline, ret))
252 print("Couldn't get default commandline! %s" % ret)
253 return 1 266 return 1
254 except xmlrpclib.Fault as x: 267 except xmlrpclib.Fault as x:
255 print("XMLRPC Fault getting commandline:\n %s" % x) 268 logger.error("XMLRPC Fault getting commandline:\n %s" % x)
256 return 1 269 return 1
257 270
258 parseprogress = None 271 parseprogress = None
@@ -447,14 +460,19 @@ def main(server, eventHandler, tf = TerminalFilter):
447 if ioerror.args[0] == 4: 460 if ioerror.args[0] == 4:
448 pass 461 pass
449 except KeyboardInterrupt: 462 except KeyboardInterrupt:
463 import time
450 termfilter.clearFooter() 464 termfilter.clearFooter()
451 if main.shutdown == 1: 465 if main.shutdown == 1:
452 print("\nSecond Keyboard Interrupt, stopping...\n") 466 print("\nSecond Keyboard Interrupt, stopping...\n")
453 server.runCommand(["stateStop"]) 467 _, error = server.runCommand(["stateStop"])
468 if error:
469 logger.error("Unable to cleanly stop: %s" % error)
454 if main.shutdown == 0: 470 if main.shutdown == 0:
455 interrupted = True
456 print("\nKeyboard Interrupt, closing down...\n") 471 print("\nKeyboard Interrupt, closing down...\n")
457 server.runCommand(["stateShutdown"]) 472 interrupted = True
473 _, error = server.runCommand(["stateShutdown"])
474 if error:
475 logger.error("Unable to cleanly shutdown: %s" % error)
458 main.shutdown = main.shutdown + 1 476 main.shutdown = main.shutdown + 1
459 pass 477 pass
460 478