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
November 26, 2008 15:06
[perl #60848] fork-exec-pipe issue in perl 5.8.6 on linux
Message ID:
# New Ticket Created by  Shubhangi 
# Please include the string:  [perl #60848]
# in the subject line of all future correspondence about this issue. 
# <URL: >

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


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About