Skip to content

Commit ce3a5c0

Browse files
Bryan C. Millsgopherbot
Bryan C. Mills
authored andcommitted
os/exec: avoid leaking a process in TestDoubleStartLeavesPipesOpen
Updates #52580. For #50436. Change-Id: I0929055ffca1ca429f6ebec7d877f4268bd1fda2 Reviewed-on: https://go-review.googlesource.com/c/go/+/436656 TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Bryan Mills <[email protected]> Auto-Submit: Bryan Mills <[email protected]> Reviewed-by: Benny Siegert <[email protected]>
1 parent 4a0a2b3 commit ce3a5c0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/os/exec/exec_test.go

+7
Original file line numberDiff line numberDiff line change
@@ -1108,9 +1108,16 @@ func TestDoubleStartLeavesPipesOpen(t *testing.T) {
11081108
if err != nil {
11091109
t.Fatal(err)
11101110
}
1111+
11111112
if err := cmd.Start(); err != nil {
11121113
t.Fatal(err)
11131114
}
1115+
t.Cleanup(func() {
1116+
if err := cmd.Wait(); err != nil {
1117+
t.Error(err)
1118+
}
1119+
})
1120+
11141121
if err := cmd.Start(); err == nil || !strings.HasSuffix(err.Error(), "already started") {
11151122
t.Fatalf("second call to Start returned a nil; want an 'already started' error")
11161123
}

0 commit comments

Comments
 (0)