Filter out broken pipe errors

后端 未结 3 1261
挽巷
挽巷 2021-01-11 11:46

I\'m getting an error returned from an io.Copy call, to which I\'ve passed a socket (TCPConn) as the destination. It\'s expected that

3条回答
  •  渐次进展
    2021-01-11 12:12

    As of go 1.13, you can use errors.Is instead of type assertions.

    if errors.Is(err, syscall.EPIPE) {
      // broken pipe
    }
    

提交回复
热议问题