From patchwork Fri Jun 8 13:41:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [bitbake-devel, v4, 08/18] knotty.py, knotty2, py: Flush and update footer on dynamic log level change Date: Fri, 08 Jun 2012 13:41:43 -0000 From: Jason Wessel X-Patchwork-Id: 29499 Message-Id: <1339162913-23759-9-git-send-email-jason.wessel@windriver.com> To: 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 --- 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