1// Copyright 2015 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 5//go:build !plan9 && !windows 6 7package exec 8 9import ( 10 "io/fs" 11 "syscall" 12) 13 14// skipStdinCopyError optionally specifies a function which reports 15// whether the provided stdin copy error should be ignored. 16func skipStdinCopyError(err error) bool { 17 // Ignore EPIPE errors copying to stdin if the program 18 // completed successfully otherwise. 19 // See Issue 9173. 20 pe, ok := err.(*fs.PathError) 21 return ok && 22 pe.Op == "write" && pe.Path == "|1" && 23 pe.Err == syscall.EPIPE 24} 25