WithReapLock sets a mutex shared between the reaper and Wait4. The reaper holds the write lock while reaping, and ForkReap holds the read lock during Wait4, preventing the reaper from stealing the child's exit status. This is only needed for tests with instant-exit children where the race window is
(mu *sync.RWMutex)
| 68 | // tests with instant-exit children where the race window is |
| 69 | // large. |
| 70 | func WithReapLock(mu *sync.RWMutex) Option { |
| 71 | return func(o *options) { |
| 72 | o.ReapLock = mu |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | type options struct { |
| 77 | ExecArgs []string |
no outgoing calls