exec_windows.go 621 B

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