[bitbake-devel] knotty: Deal with exceptions not resetting terminal configuration

Submitted by Richard Purdie on March 9, 2014, 4:58 p.m.

Details

Message ID 1394384281.7883.5.camel@ted
State New
Headers show

Commit Message

Richard Purdie March 9, 2014, 4:58 p.m.
When an exception occurred, the terminal parameters (such as echo)
may not be reset correctly. This change ensures they do get
atexit time in all cases, avoiding the terminal corruption issues
that could sometimes occur.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---

Patch hide | download patch | download mbox

diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index c1ee9f52..3dada8e 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -31,6 +31,7 @@  import time
 import fcntl
 import struct
 import copy
+import atexit
 from bb.ui import uihelper
 
 logger = logging.getLogger("BitBake")
@@ -303,6 +304,7 @@  def main(server, eventHandler, params, tf = TerminalFilter):
     taskfailures = []
 
     termfilter = tf(main, helper, console, format)
+    atexit.register(termfilter.finish)
 
     while True:
         try:
@@ -536,6 +538,4 @@  def main(server, eventHandler, params, tf = TerminalFilter):
         if return_value == 0:
             return_value = 1
 
-    termfilter.finish()
-
     return return_value