Created
July 19, 2013 21:28
-
-
Save dtenenba/6042479 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(httr) | |
myRunApp <- function(...) | |
{ | |
try(hostname <- suppressWarnings(system2(c("hostname", "-d"), | |
stdout=TRUE, stderr=NULL)), | |
silent=TRUE) | |
if (exists("hostname") && length(hostname) && | |
grepl("ec2\\.internal", hostname)) | |
{ | |
dots <- list(...) | |
dots[["launch.browser"]] <- FALSE | |
if (is.null(dots[['port']])) dots[['port']] <- 8103L | |
library(httr) | |
public.dns <- | |
httr::content(GET("http://169.254.169.254/latest/meta-data/public-hostname")) | |
url <- paste0("http://", public.dns, ":", dots[["port"]]) | |
#cat("Press Reload in the browser window that appears.\n") | |
cat("If you don't see a new window, ") | |
cat("try disabling your popup blocker and try again.\n") | |
cat("Press ESCAPE in this window when done.\n") | |
browseURL(url) | |
do.call(runApp, dots) | |
} else { | |
runApp(...) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment