From jeroen.ooms at stat.ucla.edu  Thu Jul  7 19:18:59 2016
From: jeroen.ooms at stat.ucla.edu (Jeroen Ooms)
Date: Thu, 7 Jul 2016 19:18:59 +0200
Subject: [Rd] Detecting user interrupts in R_tryEval
Message-ID: <CABFfbXv9EQdJcNDpQiBhiwA78m2YH+tC1m6NXR2SgsoJp3+pFA@mail.gmail.com>

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.



[Rd] Detecting user interrupts in R_tryEval
Jeroen Ooms