From 9d3ec7b39fcf178eaa9aa1482f0a85c257df4408 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Thu, 27 Jun 2013 12:57:19 +0000 Subject: [PATCH] fix panic with unix socket --- commands.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/commands.go b/commands.go index 6e83a79c60..3ce8c8eb98 100644 --- a/commands.go +++ b/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