in reply to Re: pipes: killing the child?
in thread pipes: killing the child?
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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: pipes: killing the child?
by rubasov (Friar) on Jan 21, 2010 at 11:23 UTC | |
|
Re^3: pipes: killing the child?
by ikegami (Patriarch) on Jan 21, 2010 at 16:17 UTC |