1
0
mirror of https://github.com/golang/go synced 2024-09-25 13:20:13 -06:00

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: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Ian Lance Taylor 2018-09-18 07:58:11 -07:00
parent 014901c5ba
commit 19ac6a82d3

View File

@ -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
}