There's funny cases in Perl where a close() on a pipe returns an error because of a signal handler having accidentally reaped the process before close() gets to it:
The second trap with SIGCHLD is related to Perl, not the operating system. Because system , open , and backticks all fork subprocesses and the operating system sends your process a SIGCHLD whenever any of its subprocesses exit, you could get called for something you weren't expecting. The built-in operations all wait for the child themselves, so sometimes the SIGCHLD will arrive before the close on the filehandle blocks to reap it. If the signal handler gets to it first, the zombie won't be there for the normal close. This makes close return false and set $! to "No child processes".
As the maintainer of a module, I have no insight in what people's signal handlers are doing and would like to shut up if I detect this situation. If close() fails because of this error, it's (probably) ok and I don't want to bother the user with it, if it fails with something else, I want to raise an exception.
What's the best way to do this? Checking $! for the literal string "No child processes" seem frivolous, wouldn't this be something else in other locales maybe?