Set the raw mode only for tty enabled containers

This commit is contained in:
Guillaume J. Charmes 2013-04-04 21:51:40 -07:00 committed by Louis Opter
parent d530d581f7
commit dcf4572a69
1 changed files with 6 additions and 2 deletions

View File

@ -787,7 +787,6 @@ func (srv *Server) CmdLogs(stdin io.ReadCloser, stdout io.Writer, args ...string
}
func (srv *Server) CmdAttach(stdin io.ReadCloser, stdout rcli.DockerConn, args ...string) error {
stdout.SetOptionRawTerminal()
cmd := rcli.Subcmd(stdout, "attach", "CONTAINER", "Attach to a running container")
if err := cmd.Parse(args); err != nil {
return nil
@ -802,6 +801,9 @@ func (srv *Server) CmdAttach(stdin io.ReadCloser, stdout rcli.DockerConn, args .
return fmt.Errorf("No such container: %s", name)
}
if container.Config.Tty {
stdout.SetOptionRawTerminal()
}
return <-container.Attach(stdin, nil, stdout, stdout)
}
@ -874,7 +876,6 @@ func (srv *Server) CmdTag(stdin io.ReadCloser, stdout io.Writer, args ...string)
}
func (srv *Server) CmdRun(stdin io.ReadCloser, stdout rcli.DockerConn, args ...string) error {
stdout.SetOptionRawTerminal()
config, err := ParseRun(args, stdout)
if err != nil {
return err
@ -887,6 +888,9 @@ func (srv *Server) CmdRun(stdin io.ReadCloser, stdout rcli.DockerConn, args ...s
fmt.Fprintln(stdout, "Error: Command not specified")
return fmt.Errorf("Command not specified")
}
if config.Tty {
stdout.SetOptionRawTerminal()
}
// Create new container
container, err := srv.runtime.Create(config)