Similarly to networking, multiple threads of program execution, user-defined streams, among other features, Common Lisp requires non-portable code for exiting the Common Lisp implementation, if possible. This library is a reasonably comprehensive solution and interface to this.

The SHUT-IT-DOWN library was created to serve my needs when writing an interactive program that needed to be able to exit. In order to clean the source of the aforementioned program a tad, I decided to split the functionality into a library. That then encouraged making this library rather comprehensive and the only expected changes involve adding more implementations.

The design disregards return values for the Lisp process on platforms that have such. There is no argument and QUIT either succeeds or fails, then returning no value. No errors should be signaled and execution should cease immediately, without further intervention, but not all implementations guarantee this for certain scenarios. The programmer should make certain that the program using this can certainly exit and has performed important work beforehand. Some implementations allow any UNWIND-PROTECTs to be ignored and others don't and so try to avoid calling QUIT inside of one. If multiple threads are being used, they should be ended first, for more certainty. In the common case of a program that is standard, sans the use of this library, there should be no issues. This library is entirely portable in the sense that it may be entered into a Common Lisp system and the QUIT function called, although the function won't do anything on an implementation it doesn't target; so it may be used in an otherwise portable program with merely a feature caveat, rather than a more serious restriction.

Here is the source, the ASDF system definition, and the documentation; here is all of that as a single file.