[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openembedded-core
Subject:    Re: [OE-core][PATCH] oe-pkgdata-util: ignore SIGPIPE
From:       "Richard Purdie" <richard.purdie () linuxfoundation ! org>
Date:       2021-04-30 13:34:48
Message-ID: 1340f9b6c44a0c6b62dc2cbb37474e9d0a4b8253.camel () linuxfoundation ! org
[Download RAW message or body]

On Tue, 2021-04-20 at 16:37 +0800, Chen Qi wrote:
> oe-pkgdata-util sometimes outputs a large amount of data. When used
> with pipe, it's likely to get the following error.
> 
> BrokenPipeError: [Errno 32] Broken pipe
> 
> The problem could be reproduced by running `oe-pkgdata-util list-pkg | less'.
> Type 'q' after running the above command, and we get the error.
> 
> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> ---
> scripts/oe-pkgdata-util | 5 +++++
> 1 file changed, 5 insertions(+)

This is far from clearcut. 

https://mail.python.org/pipermail/python-dev/2018-June/154191.html

Not quite sure what to do about this as there are pros/cons...

Cheers,

Richard

> diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util
> index 75dd23efa3..4aeb28879d 100755
> --- a/scripts/oe-pkgdata-util
> +++ b/scripts/oe-pkgdata-util
> @@ -17,6 +17,7 @@ import re
> import argparse
> import logging
> from collections import defaultdict, OrderedDict
> +from signal import signal, SIGPIPE, SIG_DFL
> 
> 
> 
> 
> scripts_path = os.path.dirname(os.path.realpath(__file__))
> lib_path = scripts_path + '/lib'
> @@ -615,6 +616,10 @@ def main():
> logger.error('Unable to find pkgdata directory %s' % args.pkgdata_dir)
> sys.exit(1)
> 
> 
> 
> 
> +    # It's possible that this program will output large contents, and when used \
> with a pipe in command line, +    # we will get a 'BrokenPipeError: [Errno 32] \
> Broken pipe'. Ignore the SIGPIPE to avoid such error. +    signal(SIGPIPE, SIG_DFL)
> +
> ret = args.func(args)
> 
> 
> 
> 
> return ret
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#151131): https://lists.openembedded.org/g/openembedded-core/message/151131
Mute This Topic: https://lists.openembedded.org/mt/82230268/4454766
Group Owner: openembedded-core+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [openembedded-core@marc.info]
-=-=-=-=-=-=-=-=-=-=-=-



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic