I created a patch: https://codereview.appspot.com/38500044/
That works, but the unit test still fails, I'm not sure how to correctly
close this pipe.
[tulip] > python runtests.py
Skipping 'test_windows_events': Windows only
Skipping 'test_windows_utils': Windows only
......................................................................................................................
............................Fatal error for
<asyncio.unix_events._UnixReadPipeTransport object at 0x7fb6a5951e10>
Traceback (most recent call last):
File "/home/jonathan/hg/tulip/asyncio/unix_events.py", line 204, in
_read_ready
data = os.read(self._fileno, self.max_size)
OSError: [Errno 5] Input/output error
Exception in callback <bound method
_UnixReadPipeTransport._call_connection_lost of
<asyncio.unix_events._UnixReadPipe
Transport object at 0x7fb6a5951e10>> (OSError(5, 'Input/output error'),)
Traceback (most recent call last):
File "/home/jonathan/hg/tulip/asyncio/events.py", line 38, in _run
self._callback(*self._args)
File "/home/jonathan/hg/tulip/asyncio/unix_events.py", line 240, in
_call_connection_lost
self._protocol.connection_lost(exc)
File "tests/test_events.py", line 135, in connection_lost
assert self.state == ['INITIAL', 'CONNECTED', 'EOF'], self.state
AssertionError: ['INITIAL', 'CONNECTED']
Le dimanche 5 janvier 2014 07:51:58 UTC+1, Guido van Rossum a écrit :
>
> Why do you report a bug using a rhetorical question? :-)
>
> Please file a bug either at http://code.google.com/p/tulip/issues/list
> or bugs.python.org (the former gets my attention, the latter might get
> other developers' attention). If you want to submit a patch with a
> test that would be super. (See
> http://code.google.com/p/tulip/wiki/Contributing .)
>
> On Sat, Jan 4, 2014 at 10:31 AM, Jonathan Slenders
> <[email protected] <javascript:>> wrote:
> > Hi all,
> >
> > Why does loop.connect_read_pipe not support the pipes that openpty()
> > creates, but is does for os.pipe()
> >
> > master, slave = os.openpty()
> > shell_out = io.open(master, 'rb', 0)
> > transport, protocol = yield from loop.connect_read_pipe(MyProtocol,
> > shell_out)
> >
> >
> > In unix_events.py, there's the following check that fails.
> >
> > if not (stat.S_ISFIFO(mode) or stat.S_ISSOCK(mode)):
> >
> >
> > I think it should be something like this:
> >
> > if not (stat.S_ISFIFO(mode) or stat.S_ISSOCK(mode) or
> stat.S_ISCHR(mode)):
> >
> >
> > I tried this patch and it resolves the issue for me. Correct me if I'm
> > wrong, but I don't think there is any reason to block character devices
> like
> > this. Actually they're not that different from a unix pipe.
> >
> >
> > For those interested in my use case:
> > I'm building something like "tmux" or "gnu screen", but in Pure Python.
> I
> > use the "pyte" library as output interpreter, but will write a custom
> > renderer.
> > Calling the subprocess_exec wrapper does not work, because it uses
> normal
> > pipes, while I want the programs that run to be aware that they are
> running
> > in a real pseudo terminal.
> >
> >
> > Cheers,
> > Jonathan
>
>
>
> --
> --Guido van Rossum (python.org/~guido)
>