Merge pull request #1482 from rstudio/barbara/runapp

Fixes #1358: more informative error message when calling runApp inside of an app's app.R
This commit is contained in:
Winston Chang
2016-12-16 10:15:35 -06:00
committed by GitHub
2 changed files with 14 additions and 0 deletions

View File

@@ -462,6 +462,9 @@ serviceApp <- function() {
.shinyServerMinVersion <- '0.3.4'
# Global flag that's TRUE whenever we're inside of the scope of a call to runApp
.globals$running <- FALSE
#' Run Shiny Application
#'
#' Runs a Shiny application. This function normally does not return; interrupt R
@@ -555,6 +558,15 @@ runApp <- function(appDir=getwd(),
handlerManager$clear()
}, add = TRUE)
if (.globals$running) {
stop("Can't call `runApp()` from within `runApp()`. If your ,",
"application code contains `runApp()`, please remove it.")
}
.globals$running <- TRUE
on.exit({
.globals$running <- FALSE
}, add = TRUE)
# Enable per-app Shiny options
oldOptionSet <- .globals$options
on.exit({