1// Copyright 2019 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package exec
6
7import "io/fs"
8
9// skipStdinCopyError optionally specifies a function which reports
10// whether the provided stdin copy error should be ignored.
11func skipStdinCopyError(err error) bool {
12	// Ignore hungup errors copying to stdin if the program
13	// completed successfully otherwise.
14	// See Issue 35753.
15	pe, ok := err.(*fs.PathError)
16	return ok &&
17		pe.Op == "write" && pe.Path == "|1" &&
18		pe.Err.Error() == "i/o on hungup channel"
19}
20