소스 검색

Merge pull request #1035 from dotcloud/fix_panic_cast

- Runtime: fix panic with unix socket
Guillaume J. Charmes 12 년 전
부모
커밋
1a201d2433
1개의 변경된 파일8개의 추가작업 그리고 2개의 파일을 삭제
  1. 8 2
      commands.go

+ 8 - 2
commands.go

@@ -1474,8 +1474,14 @@ func (cli *DockerCli) hijack(method, path string, setRawTerminal bool, in io.Rea
 		if in != nil {
 			io.Copy(rwc, in)
 		}
-		if err := rwc.(*net.TCPConn).CloseWrite(); err != nil {
-			utils.Debugf("Couldn't send EOF: %s\n", err)
+		if tcpc, ok := rwc.(*net.TCPConn); ok {
+			if err := tcpc.CloseWrite(); err != nil {
+				utils.Debugf("Couldn't send EOF: %s\n", err)
+			}
+		} else if unixc, ok := rwc.(*net.UnixConn); ok {
+			if err := unixc.CloseWrite(); err != nil {
+				utils.Debugf("Couldn't send EOF: %s\n", err)
+			}
 		}
 		// Discard errors due to pipe interruption
 		return nil