Mail Archives: cygwin-developers/1998/02/09/14:00:08
I figured out a simple way to make Sergey's code work with ptys--the
code which calls stat before opening the slave. I'm going to check
this in.
Sergey suggested another approach: have the slave write a bunch of
characters when closing, enough to wake up any read, and then have the
read check whether the slave was closed. I haven't been able to think
of a way to make that work in any manner that I find satisfactorily
reliable. We can't really assume anything about the data which comes
from the slave. We have to make sure that the master reads the last
few bytes the slave wrote before closing the pty.
Ian
Index: tty.cc
===================================================================
RCS file: /cvs/cvsfiles/devo/winsup/tty.cc,v
retrieving revision 1.6.8.1.4.8
diff -u -r1.6.8.1.4.8 tty.cc
--- tty.cc 1998/02/04 08:04:01 1.6.8.1.4.8
+++ tty.cc 1998/02/09 21:06:31
@@ -977,7 +977,8 @@
/* We store the number of open slaves + 1 in slave_handles, so
if it drops to 1 we know that all the slaves are closed. */
if (ttyp->slave_handles <= 1
- && ttyp->input_handle != INVALID_HANDLE_VALUE)
+ && ttyp->input_handle != INVALID_HANDLE_VALUE
+ && ttyp->handle_pid != ttyp->master_pid)
{
if (! CloseHandle (ttyp->input_handle))
termios_printf ("CloseHandle 7 failed (%d)\n", GetLastError ());
- Raw text -