handle panic

master
Dingjun 7 years ago
parent 2b0c794741
commit 89af1089d5

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

Loading…
Cancel
Save