From 6478dea3c8aca7147d013d6d7f5bf7805b300589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Fri, 13 Oct 2023 06:49:55 +0100 Subject: GH-110786: suppress BrokenPipeError on the sysconfig CLI (#110791) --- Lib/sysconfig/__main__.py | 5 ++++- .../next/Library/2023-10-13-01-31-27.gh-issue-110786.sThp-A.rst | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Library/2023-10-13-01-31-27.gh-issue-110786.sThp-A.rst diff --git a/Lib/sysconfig/__main__.py b/Lib/sysconfig/__main__.py index e0c3756..d7257b9 100644 --- a/Lib/sysconfig/__main__.py +++ b/Lib/sysconfig/__main__.py @@ -242,4 +242,7 @@ def _main(): if __name__ == '__main__': - _main() + try: + _main() + except BrokenPipeError: + pass diff --git a/Misc/NEWS.d/next/Library/2023-10-13-01-31-27.gh-issue-110786.sThp-A.rst b/Misc/NEWS.d/next/Library/2023-10-13-01-31-27.gh-issue-110786.sThp-A.rst new file mode 100644 index 0000000..7dab38d --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-10-13-01-31-27.gh-issue-110786.sThp-A.rst @@ -0,0 +1,2 @@ +:mod:`sysconfig`'s CLI now ignores :exc:`BrokenPipeError`, making it exit +normally if its output is being piped and the pipe closes. -- cgit v0.12