Mail Archives: cygwin/1998/12/08/14:45:10
I have some problems with building a tool which invoke fork(), pipe()
and dup() unix-commands.
It works correctly on my Unix platform (Solaris) but when I port the
source under Win32, redirections fail.
Can someone tell me why this problem occurs ...
Here is a source portion :
============================
/* Create the pipes */
pipe(pipe1) ;
pipe(pipe2) ;
parent = fork() ;
switch (parent)
{
case -1:
printf("fork() error \n");
exit(1) ;
break ;
case 0:
process = "children";
dup2(pipe2[0],STDIN_FILENO);
dup2(pipe1[1],STDOUT_FILENO) ;
close(pipe1[0]) ;
close(pipe1[1]) ;
close(pipe2[0]) ;
close(pipe2[1]) ;
system (command1) ;
fflush(stdout) ;
exit(0);
break ;
default:
process = "parent" ;
dup2(pipe1[0],STDIN_FILENO) ;
dup2(pipe2[1],STDOUT_FILENO) ;
close(pipe1[0]) ;
close(pipe1[1]) ;
close(pipe2[0]) ;
close(pipe2[1]) ;
system ("sh") ;
exit(0);
}
====================================
IPC doesn't work between "command1" and "sh"
--
=======================================================================
,',',',',',',' Aldo MAZZILLI | INRIA Rhone-Alpes |
,',',',',',',' aldo DOT mazzilli AT inrialpes DOT fr| 655, avenue de l'Europe |
,',',',',',',' Tel : 04 76 61 53 91 | 38330 Montbonnot St Martin |
,',',',',',',' Fax : 04 76 61 52 52 | FRANCE |
,',' *** Site WEB : http://www.inrialpes.fr/vasy/people/Aldo.Mazzilli |
=======================================================================
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -