summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikko Rapeli <mikko.rapeli@bmw.de>2022-09-13 04:26:33 -1000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-09-16 17:52:26 +0100
commit65cee11967f60c74fa89bb6d72f32135968a6b87 (patch)
treeaf0380fcaaa1562f95a49ee160a0ecfb513e99c3
parentc98007217b8e40f1abfdcba709185dc5ddbcd0c2 (diff)
downloadbitbake-65cee11967f60c74fa89bb6d72f32135968a6b87.tar.gz
event.py: ignore exceptions from stdout and sterr operations in atexit
When atexit functions run, stdout and stderr operations may fail, e.g. when output is piped to less but has been exited by the user. This removes error print from output of "bitbake -e sqlite3 | less" if user presses "q" before bitbake has finished processing: [Errno 32] Broken pipeError in atexit._run_exitfuncs: Traceback (most recent call last): File "/home/builder/src/poky/bitbake/lib/bb/event.py", line 135, in print_ui_queue sys.stdout.flush() Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 35167536c163eb6b7653cbcaad9f65b834d3e2f8) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/event.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/bb/event.py b/lib/bb/event.py
index df020551e..97668601a 100644
--- a/lib/bb/event.py
+++ b/lib/bb/event.py
@@ -132,8 +132,14 @@ def print_ui_queue():
if not _uiready:
from bb.msg import BBLogFormatter
# Flush any existing buffered content
- sys.stdout.flush()
- sys.stderr.flush()
+ try:
+ sys.stdout.flush()
+ except:
+ pass
+ try:
+ sys.stderr.flush()
+ except:
+ pass
stdout = logging.StreamHandler(sys.stdout)
stderr = logging.StreamHandler(sys.stderr)
formatter = BBLogFormatter("%(levelname)s: %(message)s")