(fn func())
| 467 | } |
| 468 | |
| 469 | func (r *Runner) trackCommandGoroutine(fn func()) error { |
| 470 | r.closeMutex.Lock() |
| 471 | defer r.closeMutex.Unlock() |
| 472 | if r.isClosed() { |
| 473 | return xerrors.New("track command goroutine: closed") |
| 474 | } |
| 475 | r.cmdCloseWait.Add(1) |
| 476 | go func() { |
| 477 | defer r.cmdCloseWait.Done() |
| 478 | fn() |
| 479 | }() |
| 480 | return nil |
| 481 | } |
| 482 | |
| 483 | func (r *Runner) isClosed() bool { |
| 484 | select { |