aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/testdata/testprogcgo/exec.go
diff options
context:
space:
mode:
authorFilippo Valsorda <filippo@golang.org>2018-10-15 17:09:34 -0400
committerFilippo Valsorda <filippo@golang.org>2018-10-15 17:09:34 -0400
commit623650b27aa42dd2ccd20fc4a79f8fe7b8559987 (patch)
treebfafa16d1bfd57fc1d9831c22e6e236be3d52281 /src/runtime/testdata/testprogcgo/exec.go
parent36c789b1fd72af5ff6e756794597a3a85e069998 (diff)
parent1961d8d72a53e780effa18bfa8dbe4e4282df0b2 (diff)
downloadgo-623650b27aa42dd2ccd20fc4a79f8fe7b8559987.tar.xz
[dev.boringcrypto] all: merge master into dev.boringcrypto
Change-Id: I218ba1b89a2df6e4335c6a5846889d9a04affe5d
Diffstat (limited to 'src/runtime/testdata/testprogcgo/exec.go')
-rw-r--r--src/runtime/testdata/testprogcgo/exec.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/runtime/testdata/testprogcgo/exec.go b/src/runtime/testdata/testprogcgo/exec.go
index 2e948401c8..94da5dc526 100644
--- a/src/runtime/testdata/testprogcgo/exec.go
+++ b/src/runtime/testdata/testprogcgo/exec.go
@@ -75,6 +75,14 @@ func CgoExecSignalMask() {
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
+ // An overloaded system
+ // may fail with EAGAIN.
+ // This doesn't tell us
+ // anything useful; ignore it.
+ // Issue #27731.
+ if isEAGAIN(err) {
+ return
+ }
fmt.Printf("iteration %d: %v\n", j, err)
os.Exit(1)
}
@@ -87,3 +95,11 @@ func CgoExecSignalMask() {
fmt.Println("OK")
}
+
+// isEAGAIN reports whether err is an EAGAIN error from a process execution.
+func isEAGAIN(err error) bool {
+ if p, ok := err.(*os.PathError); ok {
+ err = p.Err
+ }
+ return err == syscall.EAGAIN
+}