This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

popen/pclose: unexpected behavior


Hello,

The following program hangs when its pipes are closed in the same order in 
which they were opened, and terminates when its pipes are closed in the 
reverse order. 

I've never seen this on other platforms - it a bug? Or is there a subtlety I'm 
unaware of?

Thanks
--John

----------------------------------------

#include <stdio.h>

int main (void) 
{
  FILE *pipe1;
  FILE *pipe2;

  pipe1 = popen ("cat", "w");
  pipe2 = popen ("cat", "w");

  /* hangs unless pipes are pclosed in order pipe2,pipe1 */
  pclose (pipe1);
  pclose (pipe2);

  return 0;
}



--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]