This is the mail archive of the
mailing list for the Cygwin project.
Cygwin-Windows pipe communication
- From: Ajay Nerurkar <ajaynerurkar at yahoo dot com>
- To: cygwin at cygwin dot com
- Date: Thu, 17 Jul 2003 19:06:35 -0700 (PDT)
- Subject: Cygwin-Windows pipe communication
I have this scenario:
The parent process forks and execs a child process which is a Windows
program. The child's stdin is connected (via a dup2) to a pipe that
it uses to get input from the parent and writes it to a file.
The parent writes data to the pipe and then closes its end of the
pipe, but I find that the child hangs around waiting for more data. I
don't see this problem if I exec a Cygwin process to do the same
It seems that a pipe close by the parent is not recognized by a child
Windows process. So, I tried a little experiment.
Let's assume the parent writes to fd. Before the child execs, it
closes its copy of fd and does dup2(fd, 0). Now, if I set the
close_on_exec flag on fd IN THE PARENT before the fork, all is
fine -- the child knows that the parent has closed the other end of
the pipe. However, if I set that flag IN THE CHILD before it execs,
the problem persists.
Are there any known limitations in the Cygwin pipe implementation
when the pipe is between a Cygwin process and a Windows one? Why does
setting the close_on_exec flag in the parent get rid of the problem?
And why doesn't setting it in the child work?
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html