richfitz / stevedore

:cloud::rowboat::whale::cloud: Docker client for R
https://richfitz.github.io/stevedore
Other
134 stars 10 forks source link

resize does not work #35

Open richfitz opened 6 years ago

richfitz commented 6 years ago

enable the endpoint in docker_container with

  self$resize <- docker_client_method(
    "container_resize", self,
    fix = fix_id)

and then test with

test_that("resize", {
  d <- test_docker_client()
  nm <- rand_str(10, "stevedore_")
  x <- d$container$create("nginx", tty = TRUE, stdin = TRUE)

  on.exit({
    x$remove(force = TRUE)
  })

  x$start()
  i1 <- x$inspect()
  x$exec(c("tput", "-T", "xterm", "cols"), stream = FALSE)$output

  x$resize(h = 20, w = 40) # junk return value!
  i2 <- x$inspect()
  x$exec(c("tput", "-T", "xterm", "cols"), stream = FALSE)$output

  x$restart(t = 0)
  i3 <- x$inspect()
  x$exec(c("tput", "-T", "xterm", "cols"), stream = FALSE)$output
})

but nothing happens.

richfitz commented 6 years ago

Worth noting that this is not in the cli

richfitz commented 6 years ago

If I run:

docker run -it --rm ubuntu bash -c 'sleep 0.1; stty size'

Then I see 24 80

but this is coming from the parent terminal - I don't get that via the api