exit - exit the program

LIBRARY

(import (rnrs))                     ;R6RS
(import (rnrs programs))            ;R6RS
(import (scheme process-context))   ;R7RS

SYNOPSIS

(exit)
(exit obj)

DESCRIPTION

Exits the running program and communicates an exit value to the operating system. If no argument is supplied, the exit procedure should communicate to the operating system that the program exited normally. If an argument is supplied, the exit procedure should translate the argument into an appropriate exit value for the operating system.

If obj is #f, the exit is assumed to be abnormal.

R7RS
Runs all outstanding dynamic-wind after procedures, terminates the running program, and communicates an exit value to the operating system. In R7RS, (exit #t) is the same as (exit).

The exit procedure must not signal an exception or return to its continuation. Because of the requirement to run handlers, this procedure is not just the operating system's exit procedure.

IMPLEMENTATION NOTES

Most implementations return obj immediately to the operating system if it is a number between 0 and 255.
GNU Guile, Chez Scheme
These implementations run the dynamic-wind after procedures.

RETURN VALUES

This procedure does not return.

EXAMPLES

(exit)     ;no return

APPLICATION USAGE

This procedure should be avoided in libraries. Applications mainly use it to return errors to the operating system, indicating to the shell that the command has failed to execute correctly or indicating to the init system that the service has failed.

COMPATIBILITY

R6RS does not explicitly say that the dynamic-wind exit handlers should run. Some implementations run them and some do not.

ERRORS

This procedure can raise exceptions with the following condition types:
&assertion (R6RS)
The wrong number of arguments was passed.
R7RS
The assertions described above are errors. Implementations may signal an error, extend the procedure's domain of definition to include such arguments, or fail catastrophically.

SEE ALSO

emergency-exit(3scm), exit(3), dynamic-wind(3scm)

STANDARDS

R6RS, R7RS

HISTORY

This procedure first appeared in R6RS and later appeared in R7RS as well. MacLISP had a quit function with similar functionality.

AUTHORS

This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://github.com/schemedoc/manpages/.


Markup created by unroff 1.0sc,    March 04, 2023.