[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250508064703.5d488277@kernel.org>
Date: Thu, 8 May 2025 06:47:03 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Donald Hunter <donald.hunter@...il.com>
Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>, Eric
Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Simon
Horman <horms@...nel.org>, Jan Stancek <jstancek@...hat.com>,
donald.hunter@...hat.com
Subject: Re: [PATCH net-next v1] tools: ynl: handle broken pipe gracefully
in CLI
On Thu, 8 May 2025 12:21:02 +0100 Donald Hunter wrote:
> When sending YNL CLI output into a pipe, closing the pipe causes a
> BrokenPipeError. E.g. running the following and quitting less:
>
> ./tools/net/ynl/pyynl/cli.py --family rt-link --dump getlink | less
> Traceback (most recent call last):
> File "/home/donaldh/net-next/./tools/net/ynl/pyynl/cli.py", line 160, in <module>
> main()
> ~~~~^^
> File "/home/donaldh/net-next/./tools/net/ynl/pyynl/cli.py", line 142, in main
> output(reply)
> ~~~~~~^^^^^^^
> File "/home/donaldh/net-next/./tools/net/ynl/pyynl/cli.py", line 97, in output
> pprint.PrettyPrinter().pprint(msg)
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^
> [...]
> BrokenPipeError: [Errno 32] Broken pipe
>
> Consolidate the try block for ops and notifications, and gracefully
> handle the BrokenPipeError by adding an exception handler to the
> consolidated try block.
Reviewed-by: Jakub Kicinski <kuba@...nel.org>
Powered by blists - more mailing lists