![]() |
|
Perl: the Markov chain saw | |
PerlMonks |
Re: Detect whether a writeable filehandle has closed?by salva (Canon) |
on Jan 15, 2021 at 12:04 UTC ( #11126954=note: print w/replies, xml ) | Need Help?? |
Even if it were possible to check whether the pipe was still valid before writing to it, doing it would be a bad idea. You would be introducing a race condition as the child could die after you check the pipe but before the write operation is completed. In general, that's a bad programming practice.
The right think to do is to catch the signal or the error (see ikegami's post above).
In Section
Seekers of Perl Wisdom
|
|