in reply to Re^2: close() on opened pipe fails in forked child
in thread close() on opened pipe fails in forked child
If you are confident that only the parent thread will access the output methods, you could write the above more like:my $status = $pipe->close; die $! if $$ != $mainpid;
Both of these solutions require you to put the effort into handling the issue, which is less aesthetically pleasing to me, but gets the job done. I cannot come up with an effective way of propagating real errors and blocking apparent errors from the fork that seems elegant.if ($$ == $mainpid) { $pipe->close or die $!; }
The only other possibility that occurs to me is to check if the pipe process is a child of the current process before error propagation (as opposed to caching pid), but this does not strike me as fundamentally cleaner.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|
|---|