cmd: use net.ErrClosed for matching returned error (#4289)

Implements #3805
This commit is contained in:
M. Ángel Jimeno 2021-08-18 20:58:19 +02:00 committed by GitHub
parent 8a974a4f8f
commit 9e333c39da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,6 +19,7 @@ import (
"context" "context"
"crypto/rand" "crypto/rand"
"encoding/json" "encoding/json"
"errors"
"fmt" "fmt"
"io" "io"
"io/ioutil" "io/ioutil"
@ -119,7 +120,7 @@ func cmdStart(fl Flags) (int, error) {
for { for {
conn, err := ln.Accept() conn, err := ln.Accept()
if err != nil { if err != nil {
if !strings.Contains(err.Error(), "use of closed network connection") { if !errors.Is(err, net.ErrClosed) {
log.Println(err) log.Println(err)
} }
break break