Re: Reading from a pty after slave exited
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:received:message-id:subject:from:to:cc:content-type; bh=KQ8YhKYsErlsSclb/pVaT21ivB4IUc1GZt+wfMZSGL8=; b=Fr0EjwzR2TDe4L9y7+70vK+KcCTsPDNCU1onrs9aHGKkZhaQQckr0l3w2O21OS7fn7 9yuYXcWhwxFSUb7JlpPFJOPH/9IcMnQ26LTvNS5FBbo9MSJoxuC7WTPwNLGjo5Pnqd6B jdoG18dRUL912XDJBECQ1zgXmSbIlMoQeArlY= Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=ERCOf8NaSYjyxYtvKrDH6aZgr51Th52iCA1bHKF876sdMv9MhuGyZn7CL4Fn9Ppn6Y vxFodqD4ziL5A8ZoASfd02hTzlQHdsVGd6GKC6ZoVr4AaecIUnPz98RDaWnOPpJ7yjmM oKnMxYDlQSD1wHxhuOje3BbOUiVtKb3HtQouU= On Sat, Apr 17, 2010 at 10:36 AM, Terry Lambert <tlambert@apple.com> 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 (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com
participants (1)
-
Julian Scheid