Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <20030718020635.45362.qmail@web12507.mail.yahoo.com> Date: Thu, 17 Jul 2003 19:06:35 -0700 (PDT) From: Ajay Nerurkar Subject: Cygwin-Windows pipe communication To: cygwin AT cygwin DOT com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 thing instead. 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[1]. Before the child execs, it closes its copy of fd[1] and does dup2(fd[0], 0). Now, if I set the close_on_exec flag on fd[1] 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? Ajay __________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/