Commit f8ed4539 authored by Ian Lance Taylor's avatar Ian Lance Taylor Committed by Brad Fitzpatrick

[release-branch.go1.8] os/exec: deflake TestStdinCloseRace

Stop reporting errors from cmd.Process.Kill; they don't matter for
purposes of this test, and they can occur if the process exits quickly.

Fixes #19211.
Fixes #19213.

Change-Id: I1a0bb9170220ca69199abb8e8811b1dde43e1897
Reviewed-on: https://go-review.googlesource.com/37309
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarDaniel Martí <mvdan@mvdan.cc>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit 35ffca31)
Reviewed-on: https://go-review.googlesource.com/38607
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent d4313074
...@@ -262,9 +262,13 @@ func TestStdinCloseRace(t *testing.T) { ...@@ -262,9 +262,13 @@ func TestStdinCloseRace(t *testing.T) {
t.Fatalf("Start: %v", err) t.Fatalf("Start: %v", err)
} }
go func() { go func() {
if err := cmd.Process.Kill(); err != nil { // We don't check the error return of Kill. It is
t.Errorf("Kill: %v", err) // possible that the process has already exited, in
} // which case Kill will return an error "process
// already finished". The purpose of this test is to
// see whether the race detector reports an error; it
// doesn't matter whether this Kill succeeds or not.
cmd.Process.Kill()
}() }()
go func() { go func() {
// Send the wrong string, so that the child fails even // Send the wrong string, so that the child fails even
......
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