Set the raw mode only for tty enabled containers
Upstream-commit: dcf4572a6914e50ce8797503ff0c180027d28301 Component: engine
This commit is contained in:
committed by
Louis Opter
parent
b7ec43b00f
commit
8c4cdab2b2
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user