[bitbake-devel] [PATCH v4 08/18] knotty.py, knotty2, py: Flush and update footer on dynamic log level change
Jason Wessel
jason.wessel at windriver.com
Fri Jun 8 13:41:43 UTC 2012
This patch adds a call to update the task list after changing log
modes dynamically such that you can immediately see the remaining
tasks. After adding this functionality, it became obvious there was a
problem flushing data loaded into stdout because the task list would
not appear immediately. Doing something like "bitbake IMAGE | tee
/tmp/log" is where the flush problem manifests itself the most.
Signed-off-by: Jason Wessel <jason.wessel at windriver.com>
---
lib/bb/ui/knotty.py | 14 ++++++++++++--
lib/bb/ui/knotty2.py | 4 ++++
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py
index b4125f6..d7b1e19 100644
--- a/lib/bb/ui/knotty.py
+++ b/lib/bb/ui/knotty.py
@@ -82,9 +82,16 @@ class TerminalFilter(object):
def clearFooter(self):
return
+ def updateFooterForce(self):
+ self.printFooter(True)
+
def updateFooter(self):
- if not main.shutdown or not self.helper.needUpdate:
- return
+ self.printFooter(False)
+
+ def printFooter(self, force_update):
+ if not force_update:
+ if not main.shutdown or not self.helper.needUpdate:
+ return
activetasks = self.helper.running_tasks
runningpids = self.helper.running_pids
@@ -238,6 +245,9 @@ def main(server, eventHandler, tf = TerminalFilter):
if stdin_mgr.poll():
keyinput = sys.stdin.read(1)
rtloglevel.setLevel(keyinput, True)
+ termfilter.updateFooterForce()
+ sys.stdout.flush()
+
# Always try printing any accumulated log files first
rtloglevel.displayLogs()
if event is None:
diff --git a/lib/bb/ui/knotty2.py b/lib/bb/ui/knotty2.py
index aa6a408..01693e9 100644
--- a/lib/bb/ui/knotty2.py
+++ b/lib/bb/ui/knotty2.py
@@ -73,6 +73,10 @@ class TerminalFilter2(object):
sys.stdout.write(self.curses.tparm(self.ed))
self.footer_present = False
+ def updateFooterForce(self):
+ self.footer_present = False
+ self.updateFooter()
+
def updateFooter(self):
if not self.cuu:
return
--
1.7.10
More information about the bitbake-devel
mailing list