소스 검색

Merge pull request #1995 from dotcloud/fix_attach_2

Fix the attach behavior with -i
Victor Vieux 12 년 전
부모
커밋
bcce3cbdd1
1개의 변경된 파일10개의 추가작업 그리고 14개의 파일을 삭제
  1. 10 14
      container.go

+ 10 - 14
container.go

@@ -478,13 +478,11 @@ func (container *Container) Attach(stdin io.ReadCloser, stdinCloser io.Closer, s
 				utils.Debugf("[start] attach stdout\n")
 				defer utils.Debugf("[end]  attach stdout\n")
 				// If we are in StdinOnce mode, then close stdin
-				if container.Config.StdinOnce {
-					if stdin != nil {
-						defer stdin.Close()
-					}
-					if stdinCloser != nil {
-						defer stdinCloser.Close()
-					}
+				if container.Config.StdinOnce && stdin != nil {
+					defer stdin.Close()
+				}
+				if stdinCloser != nil {
+					defer stdinCloser.Close()
 				}
 				_, err := io.Copy(stdout, cStdout)
 				if err != nil {
@@ -516,13 +514,11 @@ func (container *Container) Attach(stdin io.ReadCloser, stdinCloser io.Closer, s
 				utils.Debugf("[start] attach stderr\n")
 				defer utils.Debugf("[end]  attach stderr\n")
 				// If we are in StdinOnce mode, then close stdin
-				if container.Config.StdinOnce {
-					if stdin != nil {
-						defer stdin.Close()
-					}
-					if stdinCloser != nil {
-						defer stdinCloser.Close()
-					}
+				if container.Config.StdinOnce && stdin != nil {
+					defer stdin.Close()
+				}
+				if stdinCloser != nil {
+					defer stdinCloser.Close()
 				}
 				_, err := io.Copy(stderr, cStderr)
 				if err != nil {