-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
I was very excited to see the contributions come in over #626 -- thank you for that. However, it looks like a SIGPIPE
issue is still possible when piping in over stdin. An example is shown below. I want to note that I have not been able to absolutely isolate the problem as can be seen below where a small test is fine but a larger test results in the exception.
$ python --version
Python 3.5.2 :: Continuum Analytics, Inc.
$ python -c "import click; print(click.__version__)"
6.7
$ uname -a
Darwin codinator.local 16.3.0 Darwin Kernel Version 16.3.0: Thu Nov 17 20:23:58 PST 2016; root:xnu-3789.31.2~1/RELEASE_X86_64 x86_64
$ cat pipeerror
#!/usr/bin/env python
import click
@click.command()
@click.option('--bar', type=click.File('r'))
def foo(bar):
for i in bar:
click.echo(i)
if __name__ == '__main__':
foo()
$ seq 1 10 | python pipeerror --bar - | head -n 2
1
$ seq 1 100 | python pipeerror --bar - | head -n 2
1
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
BrokenPipeError: [Errno 32] Broken pipe