aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Wessel <jason.wessel@windriver.com>2015-05-20 20:01:02 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-05-24 07:27:21 +0100
commit8d1748f75763b4a66516cc46d5457ee6404b1b68 (patch)
tree2dd0f126cc1e1f86b728131f41781f8c9b0a637a
parent2df35a25b4968f64adfa673d5b73442c1a30829d (diff)
downloadbitbake-8d1748f75763b4a66516cc46d5457ee6404b1b68.tar.gz
bitbake-worker: Fix regression with unbuffered logs
I noticed that I was seeing loss of the log files when hitting control-c while debugging a function in bitbake. In fact if you take a recipe and replace its compile function as shown below let it run for a few seconds and hit control-c, you will see first hand that log data is not there. do_compile () { while [ 1 ] ; do echo -n "Output date: " date sleep 1 done } It turns out there was a regression introduced by commit: d0f0e5d9e69 which created the bitbake worker. Since the bitbake worker is started in its own process space, it needs the exact same code added from commit: 88429f018b where the problem was fixed the first time around. Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xbin/bitbake-worker9
1 files changed, 9 insertions, 0 deletions
diff --git a/bin/bitbake-worker b/bin/bitbake-worker
index 8a2416125..96a4d4cde 100755
--- a/bin/bitbake-worker
+++ b/bin/bitbake-worker
@@ -24,6 +24,15 @@ if sys.argv[1] == "decafbadbad":
except:
import profile
+# Unbuffer stdout to avoid log truncation in the event
+# of an unorderly exit as well as to provide timely
+# updates to log files for use with tail
+try:
+ if sys.stdout.name == '<stdout>':
+ sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
+except:
+ pass
+
logger = logging.getLogger("BitBake")
try: