Product Documentation
Cadence SKILL Language Reference
Product Version IC23.1, November 2023

exit

exit( 
[ x_status ] 
) 
=> nil

Description

Causes SKILL to exit with a given process status (defaults to 0), whether in interactive or batch mode.

Use exit functions to customize the behavior of an exit call. Sometimes you might like to do certain cleanup actions before exiting SKILL. You can do this by registering exit-before and/or exit-after functions.

An exit-before function is called before exit does anything, and an exit-after function is called after exit has performed its bookkeeping tasks and just before it returns control to the operating system. The user-defined exit functions do not take any arguments.

To give you even more control, an exit-before function can return the atom ignoreExit to abort the exit call totally. When exit is called, first all the registered exit-before functions are called in the reverse order of registration. If any of them returns the special atom ignoreExit, the exit request is aborted and it returns nil to the caller.

After the exit-before functions are called:

  1. Some bookkeeping tasks are called.
  2. All the registered exit-after functions are called in the reverse order of their registration.
  3. Finally the process exits to the operating system.

For compatibility with earlier versions of SKILL, you can still define the functions named exitbefore and exitafter as one of the exit functions. They are treated as the first registered exit functions (the last to be called). To avoid confusing the system setup, do not use these names for other purposes.

Arguments

x_status

Process exit status; defaults to 0.

Value Returned

nil

The exit request is aborted. Otherwise there is no return value because the process exits.

Examples

In the following example, depending on the result from calling closeMyDataBase, the system either exits the application (after asking for confirmation if running in graphic mode) or aborts the exit and returns nil.

(defun myExitBefore ()
(if (closeMyDataBase)
t ; if OK in closeMyDataBase then exit
'ignoreExit)) ; otherwise we want to abort exit
regExitBefore('myExitBefore)
=> t   ; exit function is registered
exit()

Related Topics

Environment Functions

csh


Return to top
 ⠀
X