in src/ExecuteCode.cpp [200:220]
Status RPIServiceImpl::replInterrupt(ServerContext*, const Empty*, Empty*) {
if (replState == REPL_BUSY || isEventHandlerRunning()) {
asyncInterrupt();
eventLoopExecute([] {});
} else if (replState == READ_LINE) {
eventLoopExecute([=] {
if (replState == READ_LINE) {
R_interrupts_pending = 1;
breakEventLoop("");
}
});
} else if (replState == SUBPROCESS_INPUT && subprocessActive) {
eventLoopExecute([=] {
if (replState == SUBPROCESS_INPUT && subprocessActive) {
subprocessInterrupt = true;
breakEventLoop("");
}
});
}
return Status::OK;
}