withDone returns options that stop the reaper goroutine when t completes and wait for it to fully exit, preventing overlapping reapers across sequential subtests.
(t *testing.T)
| 61 | // completes and wait for it to fully exit, preventing |
| 62 | // overlapping reapers across sequential subtests. |
| 63 | func withDone(t *testing.T) []reaper.Option { |
| 64 | t.Helper() |
| 65 | stop := make(chan struct{}) |
| 66 | stopped := make(chan struct{}) |
| 67 | t.Cleanup(func() { |
| 68 | close(stop) |
| 69 | <-stopped |
| 70 | }) |
| 71 | return []reaper.Option{ |
| 72 | reaper.WithReaperStop(stop), |
| 73 | reaper.WithReaperStopped(stopped), |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | // TestReap checks that the reaper successfully reaps exited |
| 78 | // processes and passes their PIDs through the shared channel. |
no test coverage detected