That said, I think EINVAL is the best errno-error to raise when exit and emergency-exit are called with out-of-range or unknown arguments.  Remember that #t (exit code 0) and #f (some exit code) must be supported as well.

On Wed, Aug 14, 2019 at 5:34 PM John Cowan <> wrote:

---------- Forwarded message ---------
From: John Cowan <>
Date: Wed, Aug 14, 2019 at 5:32 PM
Subject: Re: Interpreting exit code given to "exit" procedure
To: Lassi Kortela <>

On Wed, Aug 14, 2019 at 5:10 PM Lassi Kortela <> wrote:

But unless the programmer is catching that error, it may lead to an exit
with a different exit code :) We should figure out which. Code 1 is not
a good error-exit code, because it's quite often used as boolean false
(e.g. grep uses code 1 to indicate it didn't find any matches.

<> says that exit code 128 should be used for this purpose.  Additional exit code conventions can be found at /usr/include/sysexit.h, but AFAIK nobody much uses them (delivermail, really???)

Of course, R7RS (and R6RS too) are deliberately silent on what happens when an exception is not caught (return to the REPL, return to the shell, assert a pin and halt the CPU, etc.)

John Cowan
And they pack their lyrics till they're so damn dense
You could put 'em in your yard and you could use 'em for a fence.
      --Alan Chapman, "Everybody Wants to Be Sondheim"