Skip to content

Commit

Permalink
use .globals rather than .runContext
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire committed Sep 27, 2013
1 parent 6df6d40 commit 5308ca1
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions R/shiny.R
Original file line number Diff line number Diff line change
Expand Up @@ -1261,8 +1261,6 @@ serviceApp <- function(ws_env) {

.shinyServerMinVersion <- '0.3.4'

.runContext <- new.env()

#' Run Shiny Application
#'
#' Runs a Shiny application. This function normally does not return; interrupt
Expand Down Expand Up @@ -1326,14 +1324,14 @@ runApp <- function(appDir=getwd(),

# determine port if we need to
if (is.null(port)) {
if (!is.null(.runContext$lastPort))
port <- .runContext$lastPort
if (!is.null(.globals$lastPort))
port <- .globals$lastPort
else
port <- sample(3000:8000, 1)
}

# set lastPort to NULL so that we don't re-use it if startApp fails
.runContext$lastPort <- NULL
.globals$lastPort <- NULL

if (is.character(appDir)) {
orig.wd <- getwd()
Expand All @@ -1345,7 +1343,7 @@ runApp <- function(appDir=getwd(),
}

# record port
.runContext$lastPort <- port
.globals$lastPort <- port

on.exit({
stopServer(server)
Expand Down

0 comments on commit 5308ca1

Please sign in to comment.