From 55983b06f4c2f42852f309c7eee176c474fdbf05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Thu, 12 Oct 2023 23:26:11 +0100 Subject: [PATCH] GH-110786: suppress BrokenPipeError on the sysconfig CLI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filipe LaĆ­ns --- Lib/sysconfig/__main__.py | 5 ++++- .../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 e0c375696969a5..d7257b9d2d00db 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 00000000000000..7dab38db11b060 --- /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.