in reply to Re^3: ActivePerl exit codes
in thread ActivePerl exit codes

It would be nice if this was tagged in perlrun somewhere, but it probably the default expectation for unix tools and so doesn't rate a mention.

It isn't. The default for most unix utilities is to just exit with 1 (or 255 for a few)[1]. Test exits with 1 for false condition and 2 for an error. A few programs give a detailed error code depending on the error. I however have never seen any (other than Perl) that would use the ERRNO code as a return value. Ruby exits with 1 no matter what.

Update: I have $? printed in my bash prompt, that's how I know.

[1]: I'm not sure in that.

Update: The glibc manual says

... it does not work to use the value of `errno' as the exit status--these can exceed 255.
This is not yet actual as the errno codes are less than 126 in my system, but there might be much more in later systems. (There are 252 syscalls in linux, they will soon exceed one byte. Lucky the number is stored in %eax so we can have up to 4G syscalls and 2G errno values:)

Replies are listed 'Best First'.
Re^5: ActivePerl exit codes
by BrowserUk (Patriarch) on Jun 11, 2004 at 15:27 UTC

    Time to peruse the sources and see how hard it would be to lift a list of exit codes and see if it's possible to come up with a reasonable document describing them.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail