Move tty into container.json

Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
Michael Crosby 2014-02-21 13:53:11 -08:00
parent 6054bda2b8
commit d67915851d
5 changed files with 11 additions and 12 deletions

View file

@ -18,7 +18,7 @@ import (
// Exec performes setup outside of a namespace so that a container can be
// executed. Exec is a high level function for working with container namespaces.
func Exec(container *libcontainer.Container, tty bool, args []string) (int, error) {
func Exec(container *libcontainer.Container, args []string) (int, error) {
var (
master *os.File
console string
@ -28,7 +28,7 @@ func Exec(container *libcontainer.Container, tty bool, args []string) (int, erro
outPipe, errPipe io.ReadCloser
)
if tty {
if container.Tty {
master, console, err = createMasterAndConsole()
if err != nil {
return -1, err
@ -44,7 +44,7 @@ func Exec(container *libcontainer.Container, tty bool, args []string) (int, erro
system.UsetCloseOnExec(r.Fd())
command := createCommand(container, console, r.Fd(), args)
if !tty {
if !container.Tty {
if inPipe, err = command.StdinPipe(); err != nil {
return -1, err
}
@ -86,7 +86,7 @@ func Exec(container *libcontainer.Container, tty bool, args []string) (int, erro
w.Close()
r.Close()
if tty {
if container.Tty {
go io.Copy(os.Stdout, master)
go io.Copy(master, os.Stdin)