Do you have a question? Post it now! No Registration Necessary. Now with pictures!
December 6, 2012, 9:30 pm
rate this thread
Calling main.sh will hang. I think that this is related with the fifo.
Does anybody know a way to make the code finish without hanging?
rm -rf head body
mkfifo head body
seq 10 | ../headbody.pl head body &
cat head body &
~/linux/bin/xplat/src/coreutils/backup/headbody/perl/fifo/main$ cat ../
#use lib "$FindBin::Bin/.";
open(HEAD, '>', $ARGV) or die "cannot to open $ARGV $!";
open(BODY, '>', $ARGV) or die "cannot to open $ARGV $!";
my $head = <STDIN>;
print HEAD $head;
close(HEAD) or die "cannot to close $ARGV $!";
print STDERR "head";
close(BODY) or die "cannot to close $ARGV $!";
print STDERR "body";
Re: terminating fifo in perl
Opening a fifo for writing will block until someone opens it for
reading. cat will not open body for reading until after it has finished
reading from head, and headbody.pl will not close head until after it
has opened body. Either close head before opening body, or open the
fifos read-write (which will not block).
- » perl 10^9 long strings of packed floats, getting 'panic: memory wrap' that didn't use to h...
- — Next thread in » PERL Discussions