-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
safe expression evaluation with callr #174
Conversation
|
R/run.R
Outdated
}) | ||
}) | ||
} | ||
|
||
|
||
safe_env <- function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be helpful to have a comment of why this function exists (because it's the same as the default for callr::r
except that it allows opening a browser).
Waiting to see response from r-lib/callr#72 about |
|
R/run.R
Outdated
#' @examples | ||
#' \dontrun{ | ||
#' # Direct usage | ||
#' safe({learnr::run_tutorial("slidy", package = "learnr")}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think having { }
around code that's used as an expression is good for some contexts (e.g., shiny and profvis), but in this case, it might just be confusing for ordinary users of learnr.
For this example, I think you also don't want learnr::
, to keep things simple for users.
Here's what you'd end up with after those two changes. This will be easier for new users to comprehend:
safe(run_tutorial("slidy", package = "learnr"))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem, I can remove the brackets.
To get the code to work, I'd need to library the learnr package. Makes sense as it's in the learnr package.
@wch Any idea on how to get around not having to require the user to say
as the Environment variable? |
Address scoping issues within #162
Pre rendered documents can now be rendered in a clean environment using:
Tutorials should be able to be run in a clean environment using:
This is done as rmarkdown has no intent on adding a new session for compilation. rstudio/rmarkdown#1204