error.level(...)
The
error.level function can be useful in constructing a
.Last
function that does different things depending on whether the exit is normal or abnormal. The
terminate function always
increments the error level, so using it (instead of
q or
exit
) guarantees that you will execute the abnormal exit options.
# Caution: This example will end your S-PLUS session
.Last <- function()
{
if(error.level() == 0)
cat("Normal exit.\n")
else
cat("Exit with problems.\n")
}
terminate()