diff options
author | Georg Brandl <georg@python.org> | 2022-07-30 09:19:24 +0200 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2022-07-30 10:54:28 +0200 |
commit | 53667339e5f32f6d6a3edce7797c815d34395b51 (patch) | |
tree | e9e3a384b5ca10dcbe1a9b181d39b3103a0a90ae /pygments | |
parent | aaca62dab28d4924651e2cf3a6fce872ab522628 (diff) | |
download | pygments-git-53667339e5f32f6d6a3edce7797c815d34395b51.tar.gz |
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
Diffstat (limited to 'pygments')
-rw-r--r-- | pygments/cmdline.py | 3 |
1 files changed, 3 insertions, 0 deletions
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) |