develooper Front page | perl.perl5.porters | Postings from November 2008

[perl #60848] fork-exec-pipe issue in perl 5.8.6 on linux

Thread Next
From:
Shubhangi
Date:
November 26, 2008 15:06
Subject:
[perl #60848] fork-exec-pipe issue in perl 5.8.6 on linux
Message ID:
rt-3.6.HEAD-10965-1227679515-1648.60848-75-0@perl.org
# New Ticket Created by  Shubhangi 
# Please include the string:  [perl #60848]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=60848 >


Hi,
I am facing a problem related to fork-exec-pipe sequence in perl on linux.
(perl version 5.8.6 on fedora linux) I have a piece of perl code on Sun
Solaris system(perl version 5.005_03) which is working absolutely fine.
However when I tried the same code on fedora linux it does not work. I am
copying the part of the code here:

pipe R1, W1; pipe R2, W2;
select((select(W2), $| = 1)[0]); # autoflush output to dotcntl
$chld = fork();
if ($chld == 0)
{
      # Child: execute FORTRAN wrapper.
      print("comes in child \n");
      close R1;
      close W2;
      open(STDIN, "<&R2");
      open(STDERR, ">&W1");
      exec("$PSE_HOME/bin/dotcntl") or print("PSE:ERROR Optimizations not
installed.\n"),
      exit 2;
} else
{
     # Parent: interact with the wrapper.
     close W1;
     close R2; #do the stuff
}
here I expect to get the parent executed first and then child repeatedly. It
works as expected on SunOS however on linux it executes child first - does
nothing, then executes parent and for obvious reasons it hangs. Do you have
any idea about what's going on here. Waiting for the reply.


Thanks,
Shubhangi

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About