瀏覽代碼

Flush whether or not there we set the rawmode to avoid the client to lock

Guillaume J. Charmes 12 年之前
父節點
當前提交
cb54e9c659
共有 2 個文件被更改,包括 6 次插入5 次删除
  1. 5 4
      commands.go
  2. 1 1
      rcli/tcp.go

+ 5 - 4
commands.go

@@ -803,9 +803,9 @@ func (srv *Server) CmdAttach(stdin io.ReadCloser, stdout rcli.DockerConn, args .
 
 
 	if container.Config.Tty {
 	if container.Config.Tty {
 		stdout.SetOptionRawTerminal()
 		stdout.SetOptionRawTerminal()
-		// Flush the options to make sure the client sets the raw mode
-		stdout.Write([]byte{})
 	}
 	}
+	// Flush the options to make sure the client sets the raw mode
+	stdout.Flush()
 	return <-container.Attach(stdin, nil, stdout, stdout)
 	return <-container.Attach(stdin, nil, stdout, stdout)
 }
 }
 
 
@@ -893,9 +893,10 @@ func (srv *Server) CmdRun(stdin io.ReadCloser, stdout rcli.DockerConn, args ...s
 
 
 	if config.Tty {
 	if config.Tty {
 		stdout.SetOptionRawTerminal()
 		stdout.SetOptionRawTerminal()
-		// Flush the options to make sure the client sets the raw mode
-		stdout.Flush()
 	}
 	}
+	// Flush the options to make sure the client sets the raw mode
+	// or tell the client there is no options
+	stdout.Flush()
 
 
 	// Create new container
 	// Create new container
 	container, err := srv.runtime.Create(config)
 	container, err := srv.runtime.Create(config)

+ 1 - 1
rcli/tcp.go

@@ -93,7 +93,7 @@ func (c *DockerTCPConn) Write(b []byte) (int, error) {
 }
 }
 
 
 func (c *DockerTCPConn) Flush() error {
 func (c *DockerTCPConn) Flush() error {
-	_, err := c.conn.Write([]byte{})
+	_, err := c.Write([]byte{})
 	return err
 	return err
 }
 }