Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on broken pipe when being pipelined to head #2193

Closed
izokina opened this issue Jul 28, 2022 · 0 comments · Fixed by #2199
Closed

Crash on broken pipe when being pipelined to head #2193

izokina opened this issue Jul 28, 2022 · 0 comments · Fixed by #2199

Comments

@izokina
Copy link

izokina commented Jul 28, 2022

The subject :)

% pygmentize -v some_reasonably_long_text_file | head
. . .
the 10 lines go here, and...
. . .
Traceback (most recent call last):
  File "/usr/bin/pygmentize", line 33, in <module>
    sys.exit(load_entry_point('Pygments==2.12.0', 'console_scripts', 'pygmentize')())
  File "/usr/lib/python3.10/site-packages/pygments/cmdline.py", line 638, in main
    return main_inner(parser, argns)
  File "/usr/lib/python3.10/site-packages/pygments/cmdline.py", line 490, in main_inner
    highlight(code, lexer, fmter, outfile)
  File "/usr/lib/python3.10/site-packages/pygments/__init__.py", line 82, in highlight
    return format(lex(code, lexer), formatter, outfile)
  File "/usr/lib/python3.10/site-packages/pygments/__init__.py", line 64, in format
    formatter.format(tokens, outfile)
  File "/usr/lib/python3.10/site-packages/pygments/formatters/terminal256.py", line 250, in format
    return Formatter.format(self, tokensource, outfile)
  File "/usr/lib/python3.10/site-packages/pygments/formatter.py", line 94, in format
    return self.format_unencoded(tokensource, outfile)
  File "/usr/lib/python3.10/site-packages/pygments/formatters/terminal256.py", line 275, in format_unencoded
    outfile.write(on + spl[-1] + off)
  File "/usr/lib/python3.10/codecs.py", line 378, in write
    self.stream.write(data)
BrokenPipeError: [Errno 32] Broken pipe
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe

Operating system ArchLinux, fresh at the moment.
Python version 3.10.5.
My file is a little more than 100 loc, it may be important for the reproduction. Theoretically :)

birkenfeld added a commit that referenced this issue Jul 30, 2022
This has come up a few times, and I see no good reason to catch
and report this error.

Fixes #2193
birkenfeld added a commit that referenced this issue Jul 30, 2022
This has come up a few times, and I see no good reason to catch
and report this error.

Fixes #2193
birkenfeld added a commit that referenced this issue Jul 30, 2022
This has come up a few times, and I see no good reason to catch
and report this error.

Fixes #2193
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant