diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-08-21 21:45:16 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-08-23 09:31:42 +0100 |
commit | a4f077b1fe28994b3180a49a969a6d044b5114e1 (patch) | |
tree | d2684ddb3968d5d194eaabe7ee18ba750ee41c16 /bitbake/lib | |
parent | db50630948394bdcd361f3511af40c1896b1a017 (diff) | |
download | poky-a4f077b1fe28994b3180a49a969a6d044b5114e1.tar.gz |
bitbake: knotty: Improve exception handling
Currently, IOErrors are just passed over due to the broken Exception
clause. A command like "bitbake X | <invalid command>" would break stdout
triggering a traceback. With these changes we print the exceptions, shut down
the server gracefully and exit which is a much nicer behaviour and is less
confusion to the user.
(Bitbake rev: 9544108f7b413038d871ce6ca88232de2f2434d9)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index 746dcf462a..bb6d4cbbec 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py | |||
@@ -508,6 +508,10 @@ def main(server, eventHandler, params, tf = TerminalFilter): | |||
508 | # ignore interrupted io | 508 | # ignore interrupted io |
509 | if ioerror.args[0] == 4: | 509 | if ioerror.args[0] == 4: |
510 | pass | 510 | pass |
511 | sys.stderr.write(str(ioerror)) | ||
512 | if not params.observe_only: | ||
513 | _, error = server.runCommand(["stateForceShutdown"]) | ||
514 | main.shutdown = 2 | ||
511 | except KeyboardInterrupt: | 515 | except KeyboardInterrupt: |
512 | termfilter.clearFooter() | 516 | termfilter.clearFooter() |
513 | if params.observe_only: | 517 | if params.observe_only: |
@@ -526,7 +530,11 @@ def main(server, eventHandler, params, tf = TerminalFilter): | |||
526 | logger.error("Unable to cleanly shutdown: %s" % error) | 530 | logger.error("Unable to cleanly shutdown: %s" % error) |
527 | main.shutdown = main.shutdown + 1 | 531 | main.shutdown = main.shutdown + 1 |
528 | pass | 532 | pass |
529 | 533 | except Exception as e: | |
534 | sys.stderr.write(str(e)) | ||
535 | if not params.observe_only: | ||
536 | _, error = server.runCommand(["stateForceShutdown"]) | ||
537 | main.shutdown = 2 | ||
530 | summary = "" | 538 | summary = "" |
531 | if taskfailures: | 539 | if taskfailures: |
532 | summary += pluralise("\nSummary: %s task failed:", | 540 | summary += pluralise("\nSummary: %s task failed:", |