Open with NOCTTY and set raw term
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)
This commit is contained in:
parent
d661720fd7
commit
43b4258c46
|
@ -13,6 +13,7 @@ import (
|
||||||
"github.com/docker/libcontainer"
|
"github.com/docker/libcontainer"
|
||||||
consolepkg "github.com/docker/libcontainer/console"
|
consolepkg "github.com/docker/libcontainer/console"
|
||||||
"github.com/docker/libcontainer/namespaces"
|
"github.com/docker/libcontainer/namespaces"
|
||||||
|
"github.com/dotcloud/docker/pkg/term"
|
||||||
)
|
)
|
||||||
|
|
||||||
var execCommand = cli.Command{
|
var execCommand = cli.Command{
|
||||||
|
@ -87,7 +88,7 @@ func startContainer(container *libcontainer.Config, dataPath string, args []stri
|
||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
|
|
||||||
slave, err := consolepkg.OpenTerminal(slavePath, syscall.O_RDWR)
|
slave, err := consolepkg.OpenTerminal(slavePath, syscall.O_RDWR|syscall.O_NOCTTY)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
|
@ -96,6 +97,19 @@ func startContainer(container *libcontainer.Config, dataPath string, args []stri
|
||||||
|
|
||||||
go io.Copy(master, os.Stdin)
|
go io.Copy(master, os.Stdin)
|
||||||
go io.Copy(os.Stdout, master)
|
go io.Copy(os.Stdout, master)
|
||||||
|
|
||||||
|
ws, err := term.GetWinsize(os.Stdin.Fd())
|
||||||
|
if err != nil {
|
||||||
|
return -1, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := term.SetWinsize(master.Fd(), ws); err != nil {
|
||||||
|
return -1, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := term.SetRawTerminal(os.Stdin.Fd()); err != nil {
|
||||||
|
return -1, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return namespaces.Exec(container, stdin, stdout, stderr, "", dataPath, args, createCommand, startCallback)
|
return namespaces.Exec(container, stdin, stdout, stderr, "", dataPath, args, createCommand, startCallback)
|
||||||
|
|
Loading…
Reference in New Issue