bitbake: process: Improve _logged_communicate buffering
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 22 Jun 2012 11:55:55 +0000 (12:55 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 25 Jun 2012 13:57:16 +0000 (14:57 +0100)
commit45f75ff1b79cae4f48a3f54a015ed47d8e3e97be
tree65a69d66996138d460b6c36c6fe03c102ed56b63
parent09dc059f730d1cbc6f4c1cc11cfa70a38f59fef6
bitbake: process: Improve _logged_communicate buffering

There are two problems with the _logged_communicate that are both
caused as a result of buffering I/O issues:

1) log truncation when python fails

2) While a bitbake task is running it is impossible to see what is
   going on if it is only writing a small incremental log that is
   smaller than the buffer, or you get only a partial log, up until
   the task exists.  It is worse in the case that stderr and stdout
   are separate file handles, because previous code blocks on the read
   of stdout and then stderr, serially.

The right approach is simply to use select() to determine if there is
data available and also flush the log before exiting.

This is based on a patch from Jason Wessel <jason.wessel@windriver.com>
with some changes to flush upon exit, abstract the non blocking file
descriptor setup and drop the buffer size parameter.

(Bitbake rev: 361fb71e907aa84c28ecec79fefc6ca39c39172f)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake/lib/bb/build.py
bitbake/lib/bb/process.py