-
Notifications
You must be signed in to change notification settings - Fork 25
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 quarto_render(as_job = TRUE)
wrapable
#105
base: main
Are you sure you want to change the base?
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.
Thanks. I understand the problem.
That looks good but I wonder if it would be a bit better to try use rlang to handle the construction of the call, especially for '...' handling
This could require the change regarding missing()
usage to make this works correctly.
I'll probably merge like this to unblock, and deal with that later
render_args <- as.list(sys.call()[-1L]) | ||
render_args <- mapply( | ||
function(arg, arg_name) paste0( | ||
arg_name, | ||
"="[nchar(arg_name) > 0L], | ||
deparse1(eval(arg, envir = parent.frame(n = 3L))) | ||
), | ||
render_args, | ||
names(render_args) | ||
) |
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 we need to handle this a bit differently for complex wrapping calls that would use ...
for example. In this case, it will not work. rlang maybe be useful for this. 🤔
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.
That's right, I didn't test with a wrapper function that uses dots, I only tested simple named args. Feel free to refactor and expand on this PR as you see fit!
# Conflicts: # tests/testthat/test-render.R
…rove-render # Conflicts: # tests/testthat/test-render.R
Thanks for updating. I postponed this for a later version, but still plan to come again into it. Thanks for the wait. |
Currently,
quarto_render()
cannot be wrapped in another function and run as a background job (as_job = TRUE
) at the same time because of a naivedeparse(Sys.call())
usage.This PR properly evaluates and then deparses all provided arguments, so arguments are actually forwarded to
quarto_render()
when called inside another function. Before this PR, the following code would fail with errorobject 'path' not found
:quarto-r/tests/testthat/test-render.R
Lines 20 to 24 in 0665e5a
Addendum: rstudio/rstudio#12764 does not make this PR obsolete.