-
Notifications
You must be signed in to change notification settings - Fork 2
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
Make example runner less clever #191
Conversation
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 would use fs::dir_delete
. I hate that unlink just fails silently.
It's a bit of a shame the r-lib
packages don't handle this well. Might be worth raising the issue with pkgload/withr/devtools.
pkgload does a new.environment
, and withr
uses do.call
to run on.exit
in that environment. I guess no one exits that environment, and I don't even know if there's an API for doing that (didn't find anything in the rlang package). Maybe if pkgload
had a do.call(return, list(), env=env)
line it would work?
https://github.com/r-lib/pkgload/blob/96d1a746f12ebf0a54157ed2a256bdc32358f9f6/R/dev-example.R#L38
https://github.com/r-lib/withr/blob/82daa902b654edabdd523e09d9a3b1b7216f7cc3/R/defer.R#L108-L111
R/cleanup.R
Outdated
@@ -42,6 +42,7 @@ | |||
##' | |||
##' @export | |||
##' @examples | |||
##' message(sprintf("Running in %s", format(environment()))) |
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.
Accidental leftover?
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.
indeed, trying to find out what withr/devtools were thinking they had as their environment - turns out it was exactly what I expected them to have, but it just did not work
Co-authored-by: Paul Liétar <[email protected]>
After a short fight, I can't get the withr deferred events to behave nicely under
devtools::run_examples
, which is I presume a similar environment topkgdown
- which leads to the silently failing examples on the docs. I've updated this to be very simple now and not try and clean up automatically at all, which should mean that the docs now run with no problems.