* [PATCH] knotty: Improve exception handling
@ 2014-08-21 20:45 Richard Purdie
0 siblings, 0 replies; only message in thread
From: Richard Purdie @ 2014-08-21 20:45 UTC (permalink / raw)
To: openembedded-core
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>
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index 746dcf4..bb6d4cb 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):
# 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:",
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-08-21 20:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-21 20:45 [PATCH] knotty: Improve exception handling Richard Purdie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox