diff --git a/util.go b/util.go index 65f47f5..7ef4892 100644 --- a/util.go +++ b/util.go @@ -20,6 +20,11 @@ var SSHLogLevel = ERROR // PipeAndClose pipe the data between c and s, close both when done func PipeAndClose(c io.ReadWriteCloser, s io.ReadWriteCloser) { + defer func() { + if err := recover(); err != nil { + log.Printf("recovered: %+v", err) + } + }() defer c.Close() defer s.Close() cc := make(chan struct{}, 2)