| 1 |
// Copyright 2017 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 |
package exec |
| 6 |
|
| 7 |
import ( |
| 8 |
"io/fs" |
| 9 |
"syscall" |
| 10 |
) |
| 11 |
|
| 12 |
func init() { |
| 13 |
skipStdinCopyError = func(err error) bool { |
| 14 |
// Ignore ERROR_BROKEN_PIPE and ERROR_NO_DATA errors copying |
| 15 |
// to stdin if the program completed successfully otherwise. |
| 16 |
// See Issue 20445. |
| 17 |
const _ERROR_NO_DATA = syscall.Errno(0xe8) |
| 18 |
pe, ok := err.(*fs.PathError) |
| 19 |
return ok && |
| 20 |
pe.Op == "write" && pe.Path == "|1" && |
| 21 |
(pe.Err == syscall.ERROR_BROKEN_PIPE || pe.Err == _ERROR_NO_DATA) |
| 22 |
} |
| 23 |
} |