on.exit records the expression given as its argument as needing
to be executed when the current function exits (either naturally or as
the result of an error). This is useful for resetting graphical
parameters or performing other cleanup actions.
If no expression is provided, i.e., the call is
on.exit code is removed.
an expression to be executed.
if TRUE, add
expr argument passed to
on.exit is recorded without
evaluation. If it is not subsequently removed/replaced by another
on.exit call in the same function, it is evaluated in the
evaluation frame of the function when it exits (including during
standard error handling). Thus any functions or variables in the
expression will be looked for in the function and its environment at
the time of exit: to capture the current value in
substitute or similar.
This is a ‘special’ primitive function: it only
evaluates the argument
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
sys.on.exit which returns the expression stored for use
on.exit() in the function in which
1 2 3 4
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.