Skip to content

Commit b058f9c

Browse files
committed
check for interrupt in Rcpp_eval
1 parent fde283d commit b058f9c

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

inst/include/Rcpp/api/meat/Rcpp_eval.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#ifndef Rcpp_api_meat_Rcpp_eval_h
1919
#define Rcpp_api_meat_Rcpp_eval_h
2020

21-
#include <R_ext/GraphicsEngine.h>
21+
#include <Rcpp/Interrupt.h>
2222

2323
namespace Rcpp{
2424

@@ -71,11 +71,14 @@ namespace Rcpp{
7171
EvalCall call;
7272
call.expr_ = expr_;
7373
call.env = env;
74-
R_ToplevelExec(Rcpp_eval, (void*)&call);
75-
if (!call.error_message.empty())
76-
throw eval_error(call.error_message);
77-
else
78-
return call.result;
74+
if (R_ToplevelExec(Rcpp_eval, (void*)&call)) {
75+
if (!call.error_message.empty())
76+
throw eval_error(call.error_message);
77+
else
78+
return call.result;
79+
} else {
80+
throw internal::InterruptedException();
81+
}
7982
}
8083

8184
}

0 commit comments

Comments
 (0)