You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I prefer to have my shiny apps run as a background job so that the console remains free. Is there a way to change the way run_dev() works in order to make that the default?
In addition, I think that this would have the added benefit of ensuring that the app runs in a clean environment, without having to clean the interactive environment, allowing the console environment to stay as is. I use golem::detach_all_attached() and rm(list=ls(all.names = TRUE)) in run_dev.R to ensure that the app runs in a clean environment each time. However, this can be slightly sub-optimal for development because if I want to do some testing/debugging in the console without having to specify the package with package::function(), it means that every time I run the app, I have to reload any libraries (usually library(tidyverse)) to avoid this during interactive coding.
Note - sorry, I didn't mean to label this as a bug or assign @ColinFay, and I"m not able to delete it to post as a feature request.
The text was updated successfully, but these errors were encountered:
As far as I understand it, this is not really the autoreload feature that we are looking for here — autoreload doesn't free the console (AFAIK).
The following code should do what you're looking for:
proc<-processx::process$new(
"Rscript",
c("-e", "golem::run_dev()"),
# This is the part of the code that will allow the subprocess# to print to the current R consolestdout="",
stderr=""
)
# When you want to stop and restartproc$kill()
This does most of what I'm looking for (for others reading, it doesn't appear in "Background Jobs", but it does keep your console available.
The only issue with this method it that even though golem::run_dev() eventually invokes golem::run_app(), which in a normal console start will open the shiny app. However using the method @ColinFay provided, it does not open the app. The localhost and port are displayed in the console upon launch, but then it's necessary to copy/paste that into a browser.
I prefer to have my shiny apps run as a background job so that the console remains free. Is there a way to change the way
run_dev()
works in order to make that the default?In addition, I think that this would have the added benefit of ensuring that the app runs in a clean environment, without having to clean the interactive environment, allowing the console environment to stay as is. I use
golem::detach_all_attached()
andrm(list=ls(all.names = TRUE))
inrun_dev.R
to ensure that the app runs in a clean environment each time. However, this can be slightly sub-optimal for development because if I want to do some testing/debugging in the console without having to specify the package withpackage::function()
, it means that every time I run the app, I have to reload any libraries (usuallylibrary(tidyverse)
) to avoid this during interactive coding.Note - sorry, I didn't mean to label this as a bug or assign @ColinFay, and I"m not able to delete it to post as a feature request.
The text was updated successfully, but these errors were encountered: