Skip to content

Commit

Permalink
test: wait for child processes to exit on test end
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasten committed Sep 21, 2023
1 parent eb04f37 commit 828325d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,14 @@ func (i IntegrationTest) StartCommand(friendlyName string, cmd *exec.Cmd) chan e
waitErr := make(chan error)
go func() {
waitErr <- cmd.Wait()
close(waitErr)
}()

// On test end, wait until the process actually exited so that the next test can start cleanly.
i.t.Cleanup(func() {
_ = cmd.Cancel()
<-waitErr
})
return waitErr
}

Expand Down

0 comments on commit 828325d

Please sign in to comment.