That form of open returns the child's pid...
Yikes! I did not know that.
Correction! It's much simpler than that. Closing the handle will close the pipe, which will result in the child killing itself (SIGPIPE) the next time it attempts to write to it.
I knew that but I didn't remember it.
my $pid = open(my $fr_chld, '-|', $^X, -le => '$|=1; { print ++$i; sleep 1; redo; }' );
I spent an hour trying to decipher that line, but I don't get it. As far as I can tell, '-|' forks the program, but then whey do you have to list $^X?
In reply to Re^2: pipes: killing the child?
by 7stud
in thread pipes: killing the child?
by 7stud
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |