You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
483 B
20 lines
483 B
// Copyright (c) Tailscale Inc & contributors
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
//go:build js || wasip1 || wasm
|
|
|
|
package neterror
|
|
|
|
import (
|
|
"errors"
|
|
"io"
|
|
"io/fs"
|
|
)
|
|
|
|
// Reports whether err resulted from reading or writing to a closed or broken pipe.
|
|
func IsClosedPipeError(err error) bool {
|
|
// Libraries may also return root errors like fs.ErrClosed/io.ErrClosedPipe
|
|
// due to a closed socket.
|
|
return errors.Is(err, fs.ErrClosed) ||
|
|
errors.Is(err, io.ErrClosedPipe)
|
|
}
|
|
|