Browse code

Make sure to flush buffer when setting raw mode

Guillaume J. Charmes authored on 2013/04/06 11:48:49
Showing 1 changed files
... ...
@@ -803,6 +803,8 @@ func (srv *Server) CmdAttach(stdin io.ReadCloser, stdout rcli.DockerConn, args .
803 803
 
804 804
 	if container.Config.Tty {
805 805
 		stdout.SetOptionRawTerminal()
806
+		// Flush the options to make sure the client sets the raw mode
807
+		stdout.Write([]byte{})
806 808
 	}
807 809
 	return <-container.Attach(stdin, nil, stdout, stdout)
808 810
 }
... ...
@@ -888,8 +890,11 @@ func (srv *Server) CmdRun(stdin io.ReadCloser, stdout rcli.DockerConn, args ...s
888 888
 		fmt.Fprintln(stdout, "Error: Command not specified")
889 889
 		return fmt.Errorf("Command not specified")
890 890
 	}
891
+
891 892
 	if config.Tty {
892 893
 		stdout.SetOptionRawTerminal()
894
+		// Flush the options to make sure the client sets the raw mode
895
+		stdout.Write([]byte{})
893 896
 	}
894 897
 
895 898
 	// Create new container