From 53667339e5f32f6d6a3edce7797c815d34395b51 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sat, 30 Jul 2022 09:19:24 +0200 Subject: cmdline: silently ignore ``BrokenPipeError`` This has come up a few times, and I see no good reason to catch and report this error. Fixes #2193 --- pygments/cmdline.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'pygments/cmdline.py') diff --git a/pygments/cmdline.py b/pygments/cmdline.py index f25b1e83..1fdf335a 100644 --- a/pygments/cmdline.py +++ b/pygments/cmdline.py @@ -638,6 +638,9 @@ def main(args=sys.argv): try: return main_inner(parser, argns) + except BrokenPipeError: + # someone closed our stdout, e.g. by quitting a pager. + return 0 except Exception: if argns.v: print(file=sys.stderr) -- cgit v1.2.1