* [PATCH] event.py: ignore exceptions from stdout and sterr operations in atexit
@ 2022-06-09 5:56 mikko.rapeli
2022-06-09 6:57 ` [bitbake-devel] " Luca Ceresoli
0 siblings, 1 reply; 2+ messages in thread
From: mikko.rapeli @ 2022-06-09 5:56 UTC (permalink / raw)
To: bitbake-devel; +Cc: Mikko Rapeli
From: Mikko Rapeli <mikko.rapeli@bmw.de>
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>
---
bitbake/lib/bb/event.py | 10 ++++++++--
1 file 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():
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")
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [bitbake-devel] [PATCH] event.py: ignore exceptions from stdout and sterr operations in atexit
2022-06-09 5:56 [PATCH] event.py: ignore exceptions from stdout and sterr operations in atexit mikko.rapeli
@ 2022-06-09 6:57 ` Luca Ceresoli
0 siblings, 0 replies; 2+ messages in thread
From: Luca Ceresoli @ 2022-06-09 6:57 UTC (permalink / raw)
To: Mikko Rapeli; +Cc: bitbake-devel
Hi Mikko,
On Thu, 9 Jun 2022 08:56:10 +0300
"Mikko Rapeli" <mikko.rapeli@bmw.de> wrote:
> From: Mikko Rapeli <mikko.rapeli@bmw.de>
>
> 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>
> ---
> bitbake/lib/bb/event.py | 10 ++++++++--
> 1 file 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
^^^^^^^^
This patch does not apply on the bitbake tree due to the extra
'bitbake/' directory component. Perhaps you generated it from a poky
tree instead?
I removed the extra component and applied it however, thus no need to
resend, and also:
Tested-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-09 6:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-09 5:56 [PATCH] event.py: ignore exceptions from stdout and sterr operations in atexit mikko.rapeli
2022-06-09 6:57 ` [bitbake-devel] " Luca Ceresoli
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.