ramnathv / htmlwidgets

HTML Widgets for R
http://htmlwidgets.org
Other
790 stars 207 forks source link

find pandoc #440

Closed Liripo closed 1 year ago

Liripo commented 1 year ago

Hello: When I use rocker docker, I have encountered the following problem.

docker run -u $UID --rm -it rocker/tidyverse:4.2 R -e 'htmlwidgets:::find_pandoc()'

The error is as follows:

> htmlwidgets:::find_pandoc()
sh: 1: //opt/pandoc/pandoc: not found
Error in system(paste(shQuote(pandoc_path), "--version"), intern = TRUE) : 
  error in running command
Calls: <Anonymous> ... get_pandoc_version -> with_pandoc_safe_environment -> force -> system
Execution halted

It was caused by https://github.com/ramnathv/htmlwidgets/blob/9827b5fbf6e184f67f5957a9769a46227cd7bf5a/R/pandoc.R#L176-L182. I would like to ask if it is possible to judge pandoc binary files directly, not just directories?

jcheng5 commented 1 year ago

I don't really know this code... but rmarkdown::find_pandoc seems to work (though it does take a surprising few seconds on my machine), so we probably just need to copy that over. @Liripo if you're up for making a pull request, I'd be grateful.

Liripo commented 1 year ago

Thanks for your reply, I will check the rmarkdown::find_pandoc and try it.