-
Notifications
You must be signed in to change notification settings - Fork 31
Description
Code running at top-level might cause new output:
later::later(~ message("foo"), 1)> foo
Or:
later::later(~ stop("foo"), 1)> later: exception occurred while executing callback:
Evaluation error: foo.
When that is the case the REPL appears to be hanging because there is no trailing prompt after the output. This gives users the impression that R is busy.
This also causes issues in ESS where the only means of communication with R is trough the process output. If later causes new output at top-level without issuing a prompt, ESS will incorrectly consider R to be busy. Among other problems this stalls the evaluation queue.
Other handlers for running code outside the REPL such as options(error = ) or addTaskCallback() do not have this problem.
To fix this, perhaps later could output the prompt once the last callback has finished running:
cat(paste0("\n", getOption("prompt")))This would signal users and ESS that R is ready to receive new commands.