aboutsummaryrefslogtreecommitdiff
path: root/src/os/exec/exec_unix.go
diff options
context:
space:
mode:
authorAlex Brainman <alex.brainman@gmail.com>2017-05-22 17:17:39 +1000
committerAlex Brainman <alex.brainman@gmail.com>2017-05-23 04:27:01 +0000
commitf3f29d1dea525f48995c1693c609f5e67c046893 (patch)
tree353048a19ca6b3ba8277c4b823ec85871b6b3555 /src/os/exec/exec_unix.go
parent5f4f7519b6c038ab6771e6c7111bcd29967f2750 (diff)
downloadgo-f3f29d1dea525f48995c1693c609f5e67c046893.tar.xz
os/exec: ignore some pipe write errors on windows
This change is windows version of CL 12152. It also extends test to cover scenarios reported on issue #20445. Some source files copied and renamed to make code clearer. Fixes #20445 Change-Id: Idd2f636f27c6bd5cfe98017ba2df911358263382 Reviewed-on: https://go-review.googlesource.com/43910 Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/os/exec/exec_unix.go')
-rw-r--r--src/os/exec/exec_unix.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/os/exec/exec_unix.go b/src/os/exec/exec_unix.go
new file mode 100644
index 0000000000..9c3e17d23a
--- /dev/null
+++ b/src/os/exec/exec_unix.go
@@ -0,0 +1,24 @@
+// Copyright 2015 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build !plan9,!windows
+
+package exec
+
+import (
+ "os"
+ "syscall"
+)
+
+func init() {
+ skipStdinCopyError = func(err error) bool {
+ // Ignore EPIPE errors copying to stdin if the program
+ // completed successfully otherwise.
+ // See Issue 9173.
+ pe, ok := err.(*os.PathError)
+ return ok &&
+ pe.Op == "write" && pe.Path == "|1" &&
+ pe.Err == syscall.EPIPE
+ }
+}