[Rd] Detecting user interrupts in R_tryEval

Jeroen Ooms jeroen.ooms at stat.ucla.edu
Thu Jul 7 19:18:59 CEST 2016


Is there any way to distinguish between an error and a user
interruption in R_tryEval? In both cases the ErrorOccurred argument is
set to 1. For my application I need a different action in case of a
SIGINT.

>From the source code I infer that R_tryEval basically wraps eval in
R_ToplevelExec, which returns TRUE if fun returns normally, FALSE if
it results in a jump to top level. However both an error and SIGINT
result in a jump. Is there an alternative method, or some method of
finding out which is the two happened after calling R_tryEval?

One thing I tried is see if R_curErrorBuf() is empty. However this is
unreliable because in the case of an interrupt, the error buffer
sometimes contains some old error message.



More information about the R-devel mailing list