yihui / servr

A simple HTTP server in R
https://cran.rstudio.com/package=servr
278 stars 35 forks source link

servr::rmdv2 is blocking ? #45

Closed statquant closed 4 years ago

statquant commented 4 years ago

Hello, I might have misunderstood but it seems running servr::rmdv2(host = "0.0.0.0", browser = FALSE, daemon = TRUE) is blocking the terminal it has been run in.

The following repex blocks when wait: TRUE (sorry I do not know how to escape the ` properly in github) Is it normal behavior, I would expect the kniting to be done on a background thread ?

---
title: "My First R Markdown Document"
author: "Author: Your Name"
date: "Last update: `r format(Sys.time(), '%d %B, %Y')`"
output: html_document
params:
 wait: TRUE
---
Hello
\```{r, echo = params$wait, eval = params$wait}
Sys.sleep(15)
\```
Good bye

I run R 4.0.2 on centos7 I've made the following video to illustrate

servr

yihui commented 4 years ago

Knitting is done in another R session via system2('Rscript', c('-e', 'rmarkdown::render("input.Rmd")')), which blocks your current R session.