http://www.perlmonks.org?node_id=11126913


in reply to Re: Detect whether a writeable filehandle has closed?
in thread Detect whether a writeable filehandle has closed?

Thank you. In fact, I had already tried the kill 0 technique, and it didn't work, just as you described.

I'm going to try the /proc/$pid method. But I'm afraid that that might also yield a false negative if I haven't reaped the child yet. (ps shows "defunct".) (I suspect that that would also explain why kill 0 doesn't do what we expect either.)

Replies are listed 'Best First'.
Re^3: Detect whether a writeable filehandle has closed?
by shmem (Chancellor) on Jan 14, 2021 at 15:10 UTC
    (ps shows "defunct".)

    You need waitpid to reap the zombie.

    perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'