Re: Reading from a pty after slave exited
Re: Reading from a pty after slave exited
- Subject: Re: Reading from a pty after slave exited
- From: Julian Scheid <email@hidden>
- Date: Mon, 19 Apr 2010 14:55:23 +1200
On Sat, Apr 17, 2010 at 10:36 AM, Terry Lambert <email@hidden> wrote:
> These aren't the only differences in behaviour, but they're the ones that
> are important for your specific case.
Thank you for taking the time to reply and explain the situation, I
have a much better understanding of BSD ptys now.
Unfortunately, I still don't see how I can solve my real-world issue
which goes beyond the test case from my previous post. Allow me to
explain by example.
Let's pretend I wanted to implement a GNU Screen clone in pure Python
(which provides module pty [1], straightforward bindings for openpty
and friends.) A Screen clone is not what I'm trying to do but it
makes for a good example.
Because in Screen arbitrary programs are launched in the slave using
exec(3), I don't have any control over when the slave closes the fd.
Because programs launched in Screen need to think they are talking to
a terminal, it has to be a pty -- as far as I can see, I can't use a
socketpair.
Since the clone is meant to be pure Python, I can't just look at what
Screen does and do the same thing. Well: maybe I could, but it turns
out that Screen uses open_controlling_pty on OS X [3] and from all I
can tell that appears to be an undocumented function (?) and Python
doesn't provide a binding for it.
If I understand your reply correctly, that leaves me with VMIN/VTIME
tweaking. I tried doing so (clearing the ICANON flag as suggested by
[2]) but to no avail. Are you sure these settings can be used for
this purpose? I tried applying VMIN/VTIME to the read end (in the
master) in various constellations (0/0, 0/255, 255/0 and 255/255)
without any luck, but maybe that's because I misunderstand the purpose
of these settings. Could you point me at authoritative documentation
for VMIN/VTIME? I wasn't able to find anything in tcsetattr(3),
termios(4), or searching the web.
Is it not possible to implement something akin to Screen to work
reliably on both Linux and OS X using POSIX interfaces, without
resorting to hacks such as those found in [3]?
Thanks in advance.
[1] http://docs.python.org/library/pty.html
[2] http://www.unixwiz.net/techtips/termios-vmin-vtime.html
[3] http://git.savannah.gnu.org/cgit/screen.git/tree/src/pty.c
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden