FunctionPackage: exclToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.2
Unrevised from 8.1 to 8.2.
8.1 version

exit

Arguments: &optional code &key no-unwind quiet

This exits to the shell or OS, without querying the user, returning code to the program which invoked Common Lisp. code must be an integer whose range is determined by the Operating System, and hence the value may be truncated for large integers.

The keyword argument no-unwind defaults to nil. When it is nil  exit causes each process to throw out of its current computation thereby executing all outstanding unwind-protect cleanup forms (see process-kill). If an error occurs during the execution of an unwind-protect cleanup form or the process becomes inactive, then exit could hang forever waiting for the process to die. exit prints the name of processes on which it is waiting. Processes which cause exit to hang indefinitely (because the error causes the process to enter a break level) can be killed manually from another window or editor buffer, or exit can be interrupted with C-c. Note, if exit is executed again after being interrupted, the unwind-protect which caused it to hang will likely not do so again, because execution will already have exited the offending unwind-protect; for this reason, exit could possibly be re-evaluated.

The keyword argument quiet defaults to nil. If it is specified true, information about what Lisp is doing as it exits, normally printed, is suppressed.

If no-unwind is true, then exit does not evaluate unwind-protect cleanup forms. Therefore, evaluating the form

(exit 0 :no-unwind t)

should always cause Lisp to exit.

See also *exit-cleanup-forms* which is a list of forms to evaluated before exiting.

See How to exit Lisp in startup.htm.

A non-zero code on Windows

For images started on Windows with default command-line arguments, a non-zero code will cause the Lisp console to remain alive. In this picture, we show an mlisp window after evaluating (exit 12 :quiet t :no-unwind t):

There is no active prompt, but all exit messages are preserved. Note this happens even if the console is not visible and there is no apparent way to make it visible. (There is often no console visible if you are running Lisp as a service on Windows.) To ensure calling exit with a non-zero code in fact causes Lisp to fully exit on Windows, start the image with the +M option. See the table Command line arguments starting with a + [Windows only] in Command line arguments in startup.htm for more information.


Copyright (c) 1998-2016, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.1 page.
Created 2010.1.21.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.2
Unrevised from 8.1 to 8.2.
8.1 version