From i@uc@r86 @ending from gm@il@com  Sat Jul 28 18:59:43 2018
From: i@uc@r86 @ending from gm@il@com (=?UTF-8?B?ScOxYWtpIMOaY2Fy?=)
Date: Sat, 28 Jul 2018 18:59:43 +0200
Subject: [Rd] re-throwing an interrupt condition
In-Reply-To: <CABtg=Knd2fmhRZcokroQmV8yv_p_X3OKRWtfwiRrhb-5YJMfpg@mail.gmail.com>
References: <CABtg=Knd2fmhRZcokroQmV8yv_p_X3OKRWtfwiRrhb-5YJMfpg@mail.gmail.com>
Message-ID: <CALEXWq0aNQR7FG7pSiDbcMuUTG6c1K2sF-GK-GeGaeVOv=Y=Kw@mail.gmail.com>

El s?b., 28 jul. 2018 a las 18:30, G?bor Cs?rdi
(<csardi.gabor at gmail.com>) escribi?:
>
> Anyone knows a way to re-throw a caught interrupt condition, so that
> it behaves just like the original one? I.e. no error message is
> printed, but the execution is stopped of course. With just calling
> stop in the error handler, it prints the error message, or, if there
> is no error message (like in the original interrupt condition),
> another error happens.
>
> tryCatch(Sys.sleep(100), interrupt = function(e) {  e$message <-
> "interrupted"; stop(e) } )
> <press CTRL + C / ESC here>
> #> Error: interrupted
>
> tryCatch(Sys.sleep(100), interrupt = function(e) stop(e))
> <press CTRL + C / ESC here>
> #> Error in stop(e) : bad error message

Sorry, I probably misunderstood your intention, but... simply by not
calling stop at all? This is what I see:

> tryCatch(Sys.sleep(100), interrupt = function(e) do_something <<- 1)
<press CTRL + C / ESC here>
^C>
> do_something
[1] 1

I?aki



[Rd] re-throwing an interrupt condition
=?UTF-8?B?ScOxYWtpIMOaY2Fy?=