Make quarto_render(as_job = TRUE) wrapable#105
Conversation
cderv
left a comment
There was a problem hiding this comment.
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.
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.
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. |
fixup correct function name
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.