rstudio / blogdown

Create Blogs and Websites with R Markdown
https://pkgs.rstudio.com/blogdown/
1.74k stars 331 forks source link

Using RStudio addins will kill the hugo server in the background #721

Open yihui opened 2 years ago

yihui commented 2 years ago

I upgraded RStudio from 2022.02.3,492 to 2022.07.1,554 yesterday and found that the hugo server launched by blogdown::serve_site() would almost always be killed after I close any RStudio addin (e.g., the "New Post" addin of blogdown). That is, as soon as I close the addin, the website preview is dead. This only happens with options(blogdown.use.processx = FALSE) (i.e., the background process is launched via system2(wait = FALSE)).

I spent a couple of hours on trying to figure out why this happens but didn't find out the culprit. I thought it was because of the new RStudio version, but even if I go back to the older version, the same thing occurs. Other findings:

  1. It's not limited to RStudio addins, but any Shiny apps. If I run and stop any Shiny app, the hugo server is stopped, too.
  2. I tested several Hugo versions and only 0.25/0.26 survived. I also tested other background processes (e.g., a shell script with an infinite loop), and they wouldn't be killed.
  3. options(blogdown.use.processx = TRUE) works fine (the process won't be killed).

I'm not sure if this is specific to macOS. @cderv Are you able to reproduce it on Windows/Linux?