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-22 00:06:15 +0100 |
commit | 9544108f7b413038d871ce6ca88232de2f2434d9 (patch) | |
tree | 491f36c29dcf8a1c4da6b18fb8e8af71edbe7cbd | |
parent | 1f28d8d3311262427938180435b68f0a35c2b330 (diff) | |
download | bitbake-contrib-9544108f7b413038d871ce6ca88232de2f2434d9.tar.gz |
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.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | lib/bb/ui/knotty.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py index 746dcf462..bb6d4cbbe 100644 --- a/lib/bb/ui/knotty.py +++ b/lib/bb/ui/knotty.py @@ -508,6 +508,10 @@ def main(server, eventHandler, params, tf = TerminalFilter): # ignore interrupted io if ioerror.args[0] == 4: pass + sys.stderr.write(str(ioerror)) + if not params.observe_only: + _, error = server.runCommand(["stateForceShutdown"]) + main.shutdown = 2 except KeyboardInterrupt: termfilter.clearFooter() if params.observe_only: @@ -526,7 +530,11 @@ def main(server, eventHandler, params, tf = TerminalFilter): logger.error("Unable to cleanly shutdown: %s" % error) main.shutdown = main.shutdown + 1 pass - + except Exception as e: + sys.stderr.write(str(e)) + if not params.observe_only: + _, error = server.runCommand(["stateForceShutdown"]) + main.shutdown = 2 summary = "" if taskfailures: summary += pluralise("\nSummary: %s task failed:", |