pachadotdev / analogsea

Digital Ocean R client
https://pacha.dev/analogsea/
Apache License 2.0
154 stars 24 forks source link

droplet_ssh() without a command freezes R session #76

Closed wch closed 9 years ago

wch commented 9 years ago

This is what it does:

> droplet_ssh(xyz)
Pseudo-terminal will not be allocated because stdin is not a terminal.
stdin: is not a tty

And then it hangs. In RStudio, the R session needs to be terminated.

sckott commented 9 years ago

Does this change work:

droplet_ssh <- function(droplet, ..., user = "root", verbose = FALSE) {
  droplet <- as.droplet(droplet)  

  lines <- paste(c(...), collapse = " \\\n&& ")
  if(lines == "") stop("Provide commands", call. = FALSE) # the change is here
  cmd <- paste0(
    "ssh ", ssh_options(), 
    " ", user, "@", droplet_ip(droplet), 
    " ", shQuote(lines)
  )
  do_system(droplet, cmd, verbose = verbose)
}
droplets()[[1]] %>% droplet_ssh() 

Error: Provide commands