Skip to content

quarto_render() throws an uninformative error when output is an absolute path #126

@gadenbuie

Description

@gadenbuie

In renderthis we do something that's equivalent to quarto_render("slides.qmd", output = tempfile(fileext = ".html")). (Sidenote: this certainly worked at some point, but is now failing.)

By default, in this scenario, the error will read:

quarto_render("slides.qmd", output = tempfile(fileext = ".html"))
#> Error in "processx::run(quarto_bin, args, echo = TRUE)" : 
#>   ! System command 'quarto' failed

but with quiet = FALSE we uncover the underlying error (the message it uncovers is, honestly, a bit confusing).

quarto_render("slides.qmd", output = tempfile(fileext = ".html"), quiet = FALSE)
#> ERROR: --output option cannot specify a relative or absolute path
#> 
#> Error: --output option cannot specify a relative or absolute path
#>   at parseRenderFlags (file:///Applications/quarto/bin/quarto.js:42392:31)
#>   at Command.fn (file:///Applications/quarto/bin/quarto.js:90845:25)
#>   at Command.execute (file:///Applications/quarto/bin/quarto.js:8437:24)
#>   at Command.parseCommand (file:///Applications/quarto/bin/quarto.js:8333:25)
#>   at async quarto (file:///Applications/quarto/bin/quarto.js:127540:5)
#>   at async file:///Applications/quarto/bin/quarto.js:127558:9

Edit: actually I realized our situation was slightly more nuanced. The temp file isn't in a different directory, but rather pointed to a location adjacent to the source input. Maybe quarto render previously allowed this scenario and is now more strict? Here's a better pseudo-reprex:

tmp_out <- file.path(getwd(), basename(tempfile(fileext = ".html")))
quarto_render("slides.Rmd", output = tmp_out)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions