Commit 19ac6a82 authored by Ian Lance Taylor's avatar Ian Lance Taylor

runtime: ignore EAGAIN from exec in TestCgoExecSignalMask

Fixes #27731

Change-Id: Ifb4d57923b1bba0210ec1f623d779d7b5f442812
Reviewed-on: https://go-review.googlesource.com/135995
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: 's avatarMichael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 014901c5
...@@ -75,6 +75,14 @@ func CgoExecSignalMask() { ...@@ -75,6 +75,14 @@ func CgoExecSignalMask() {
cmd.Stdout = os.Stdout cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil { 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) fmt.Printf("iteration %d: %v\n", j, err)
os.Exit(1) os.Exit(1)
} }
...@@ -87,3 +95,11 @@ func CgoExecSignalMask() { ...@@ -87,3 +95,11 @@ func CgoExecSignalMask() {
fmt.Println("OK") 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
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment