On 2015-05-17 07:40:28 -0700, Kevin J. McCarthy wrote:
> However, taking another look at close() in the perl book, I do see that
> $! may also be non-zero "if a syscall fails".  I will add a check for
> that to the close() call (along with a comment that the callers are
> checking $?) and resend the patch later today.  Does that sound good?

I think that's OK. The Perl manual gives:

    If the filehandle came from a piped open, "close" returns false if
    one of the other syscalls involved fails or if its program exits
    with non-zero status. If the only problem was that the program
    exited non-zero, $! will be set to 0. Closing a pipe also waits
    for the process executing on the pipe to exit--in case you wish to
    look at the output of the pipe afterwards--and implicitly puts the
    exit status value of that command into $? and
    ${^CHILD_ERROR_NATIVE}".

with the example:

    close OUTPUT                # wait for sort to finish
        or warn $! ? "Error closing sort pipe: $!"
                   : "Exit status $? from sort";

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

Reply via email to