summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikko Rapeli <mikko.rapeli@bmw.de>2022-06-09 08:56:10 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-06-11 10:30:56 +0100
commit5ed5a3cc8a4d819a0af8ee59f0c960bc4de07b61 (patch)
tree08636423a91dc54727d7ecacb91ebef972c577fa
parent6c5944c114b9bb33673138e9e84959415abfc8a1 (diff)
downloadpoky-5ed5a3cc8a4d819a0af8ee59f0c960bc4de07b61.tar.gz
bitbake: 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() (Bitbake rev: 35167536c163eb6b7653cbcaad9f65b834d3e2f8) Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/event.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index df020551e3..97668601a1 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -132,8 +132,14 @@ def print_ui_queue():
132 if not _uiready: 132 if not _uiready:
133 from bb.msg import BBLogFormatter 133 from bb.msg import BBLogFormatter
134 # Flush any existing buffered content 134 # Flush any existing buffered content
135 sys.stdout.flush() 135 try:
136 sys.stderr.flush() 136 sys.stdout.flush()
137 except:
138 pass
139 try:
140 sys.stderr.flush()
141 except:
142 pass
137 stdout = logging.StreamHandler(sys.stdout) 143 stdout = logging.StreamHandler(sys.stdout)
138 stderr = logging.StreamHandler(sys.stderr) 144 stderr = logging.StreamHandler(sys.stderr)
139 formatter = BBLogFormatter("%(levelname)s: %(message)s") 145 formatter = BBLogFormatter("%(levelname)s: %(message)s")