HenrikBengtsson / startup

:wrench: R package: startup - Friendly R Startup Configuration
https://henrikbengtsson.github.io/startup/
163 stars 5 forks source link

BUG: restartup() should work in a RStudio *Terminal* #48

Closed HenrikBengtsson closed 6 years ago

HenrikBengtsson commented 6 years ago

Contrary to the RStudio Console, it should be possible to restart an RStudio Terminal. However, restartup() is too strict (only looks at the startup::sysinfo()$rstudio flag) and prevents it from restarting R when running in an RStudio Terminal.

HenrikBengtsson commented 6 years ago

Asked question on https://community.rstudio.com/t/programmatically-detect-rstudio-terminal-vs-rstudio-console/4107 on how to best distinguish RStudio Console from RStudio Terminal.

HenrikBengtsson commented 6 years ago

Created a feature request for rstudioapi::restartSession() to provide more control on the new session so startup::restart() could also work in the RStudio Console.

HenrikBengtsson commented 6 years ago

The RStudio Terminal can be detected by testing for env var RSTUDIO_TERM not being empty

HenrikBengtsson commented 6 years ago

Part of this added sysinfo() field rstudioterm - however, since it's more likely that one which to test for RStudio Console it's probably better to have a unique flag for that instead of as now rstudio=TRUE,rstudioterm=FALSE.

For convenience and backward compatibility, rstudio could be the flag for the console only, and rstudioterm for the terminal.

HenrikBengtsson commented 6 years ago

Fixed in commit d921e85