diff options
-rw-r--r-- | CHANGES | 2 | ||||
-rw-r--r-- | pygments/cmdline.py | 3 |
2 files changed, 5 insertions, 0 deletions
@@ -64,6 +64,8 @@ Version 2.13.0 ``importlib.metadata`` nor ``importlib_metadata`` is found, but it will be slower. +- Silently ignore ``BrokenPipeError`` in the command-line interface + (#2193). - The ``HtmlFormatter`` now uses the ``linespans`` attribute for ``anchorlinenos`` if the ``lineanchors`` attribute is unset (#2026). - The ``highlight``, ``lex`` and ``format`` functions no longer 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) |