tty: move IO of master pty to be done with epoll

This moves all console code to use github.com/containerd/console library to
handle console I/O. Also move to use EpollConsole by default when user requests
a terminal so we can still cope when the other side temporarily goes away.

Signed-off-by: Daniel Dao <dqminh89@gmail.com>
This commit is contained in:
Daniel Dao
2017-05-19 18:18:43 +01:00
parent e775f0fba3
commit 91eafcbc65
22 changed files with 1120 additions and 230 deletions
+12 -3
View File
@@ -10,6 +10,7 @@ import (
"testing"
"time"
"github.com/containerd/console"
"github.com/opencontainers/runc/libcontainer"
"github.com/opencontainers/runc/libcontainer/configs"
"github.com/opencontainers/runc/libcontainer/utils"
@@ -289,7 +290,7 @@ func TestExecInTTY(t *testing.T) {
defer child.Close()
ps.ConsoleSocket = child
type cdata struct {
c libcontainer.Console
c console.Console
err error
}
dc := make(chan *cdata, 1)
@@ -299,10 +300,18 @@ func TestExecInTTY(t *testing.T) {
dc <- &cdata{
err: err,
}
return
}
libcontainer.SaneTerminal(f)
c, err := console.ConsoleFromFile(f)
if err != nil {
dc <- &cdata{
err: err,
}
return
}
console.SaneTerminal(f)
dc <- &cdata{
c: libcontainer.ConsoleFromFile(f),
c: c,
}
}()
err = container.Run(ps)